From 3071f5a6db977bc609dcfff668cf2a8f9febfaa3 Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Fri, 18 Mar 2022 15:53:49 +0100 Subject: [PATCH] [IMP] runbot: adapt for odoo 15.0 --- requirements.txt | 2 +- runbot/__manifest__.py | 9 +++++++-- runbot/controllers/frontend.py | 4 ++-- runbot/models/build.py | 4 ++-- runbot/models/bundle.py | 6 +++--- runbot/models/dockerfile.py | 2 +- runbot/security/ir.model.access.csv | 4 ++-- runbot/templates/batch.xml | 2 +- runbot/templates/build.xml | 8 ++++---- runbot/templates/build_stats.xml | 2 +- runbot/templates/dockerfile.xml | 2 +- runbot/templates/nginx.xml | 4 ++-- runbot/templates/utils.xml | 6 +++--- runbot/views/assets.xml | 7 ------- runbot_merge/views/templates.xml | 3 +-- 15 files changed, 31 insertions(+), 34 deletions(-) delete mode 100644 runbot/views/assets.xml diff --git a/requirements.txt b/requirements.txt index 4501d4b5..773164a1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -matplotlib==3.1.2 +matplotlib==3.5.0 unidiff diff --git a/runbot/__manifest__.py b/runbot/__manifest__.py index c1603c7a..7ca68dee 100644 --- a/runbot/__manifest__.py +++ b/runbot/__manifest__.py @@ -36,8 +36,6 @@ 'templates/nginx.xml', 'templates/build_error.xml', - 'views/assets.xml', - 'views/branch_views.xml', 'views/build_error_views.xml', 'views/build_views.xml', @@ -59,4 +57,11 @@ 'views/menus.xml', ], 'license': 'LGPL-3', + + 'assets': { + 'web.assets_backend': [ + 'runbot/static/src/js/json_field.js', + ], + } + } diff --git a/runbot/controllers/frontend.py b/runbot/controllers/frontend.py index 2ce959ec..75310d4f 100644 --- a/runbot/controllers/frontend.py +++ b/runbot/controllers/frontend.py @@ -53,7 +53,7 @@ def route(routes, **kw): response.qcontext['current_path'] = request.httprequest.full_path response.qcontext['refresh'] = refresh response.qcontext['filter_mode'] = filter_mode - response.qcontext['default_category'] = request.env['ir.model.data'].xmlid_to_res_id('runbot.default_category') + response.qcontext['default_category'] = request.env['ir.model.data']._xmlid_to_res_id('runbot.default_category') response.qcontext['qu'] = QueryURL('/runbot/%s' % (slug(project)), path_args=['search'], search=search, refresh=refresh) if 'title' not in response.qcontext: response.qcontext['title'] = 'Runbot %s' % project.name or '' @@ -152,7 +152,7 @@ class Runbot(Controller): query.limit=40 bundles = env['runbot.bundle'].browse(query) - category_id = int(request.httprequest.cookies.get('category') or 0) or request.env['ir.model.data'].xmlid_to_res_id('runbot.default_category') + category_id = int(request.httprequest.cookies.get('category') or 0) or request.env['ir.model.data']._xmlid_to_res_id('runbot.default_category') trigger_display = request.httprequest.cookies.get('trigger_display_%s' % project.id, None) if trigger_display is not None: diff --git a/runbot/models/build.py b/runbot/models/build.py index 5521b2cd..9a6ebba5 100644 --- a/runbot/models/build.py +++ b/runbot/models/build.py @@ -154,9 +154,9 @@ class BuildResult(models.Model): trigger_id = fields.Many2one('runbot.trigger', related='params_id.trigger_id', store=True, index=True) # state machine - global_state = fields.Selection(make_selection(state_order), string='Status', compute='_compute_global_state', store=True) + global_state = fields.Selection(make_selection(state_order), string='Status', compute='_compute_global_state', store=True, recursive=True) local_state = fields.Selection(make_selection(state_order), string='Build Status', default='pending', required=True, index=True) - global_result = fields.Selection(make_selection(result_order), string='Result', compute='_compute_global_result', store=True) + global_result = fields.Selection(make_selection(result_order), string='Result', compute='_compute_global_result', store=True, recursive=True) local_result = fields.Selection(make_selection(result_order), string='Build Result') triggered_result = fields.Selection(make_selection(result_order), string='Triggered Result') # triggered by db only diff --git a/runbot/models/bundle.py b/runbot/models/bundle.py index 9ec47a47..4578658c 100644 --- a/runbot/models/bundle.py +++ b/runbot/models/bundle.py @@ -35,7 +35,7 @@ class Bundle(models.Model): base_id = fields.Many2one('runbot.bundle', 'Base bundle', compute='_compute_base_id', store=True) to_upgrade = fields.Boolean('To upgrade', compute='_compute_to_upgrade', store=True, index=False) - version_id = fields.Many2one('runbot.version', 'Version', compute='_compute_version_id', store=True) + version_id = fields.Many2one('runbot.version', 'Version', compute='_compute_version_id', store=True, recursive=True) version_number = fields.Char(related='version_id.number', store=True, index=True) previous_major_version_base_id = fields.Many2one('runbot.bundle', 'Previous base bundle', compute='_compute_relations_base_id') @@ -129,7 +129,7 @@ class Bundle(models.Model): def _compute_last_batchs(self): batch_ids = defaultdict(list) if self.ids: - category_id = self.env.context.get('category_id', self.env['ir.model.data'].xmlid_to_res_id('runbot.default_category')) + category_id = self.env.context.get('category_id', self.env['ir.model.data']._xmlid_to_res_id('runbot.default_category')) self.env.cr.execute(""" SELECT id @@ -161,7 +161,7 @@ class Bundle(models.Model): # self.env['runbot.batch'].flush() for bundle in self: bundle.last_done_batch = False - category_id = self.env.context.get('category_id', self.env['ir.model.data'].xmlid_to_res_id('runbot.default_category')) + category_id = self.env.context.get('category_id', self.env['ir.model.data']._xmlid_to_res_id('runbot.default_category')) self.env.cr.execute(""" SELECT id diff --git a/runbot/models/dockerfile.py b/runbot/models/dockerfile.py index a3797f1b..f08d8475 100644 --- a/runbot/models/dockerfile.py +++ b/runbot/models/dockerfile.py @@ -37,7 +37,7 @@ class Dockerfile(models.Model): def _compute_dockerfile(self): for rec in self: try: - res = rec.template_id._render().decode() if rec.template_id else '' + res = rec.template_id._render() if rec.template_id else '' rec.dockerfile = re.sub(r'^\s*$', '', res, flags=re.M).strip() except QWebException: rec.dockerfile = '' diff --git a/runbot/security/ir.model.access.csv b/runbot/security/ir.model.access.csv index cbfc0f25..ea3a2446 100644 --- a/runbot/security/ir.model.access.csv +++ b/runbot/security/ir.model.access.csv @@ -117,6 +117,6 @@ access_runbot_codeowner_user,runbot_codeowner_user,runbot.model_runbot_codeowner access_runbot_commit_export_admin,runbot_commit_export_admin,runbot.model_runbot_commit_export,runbot.group_runbot_admin,1,1,1,1 -access_runbot_trigger_custom_wizard,access_runbot_trigger_custom_wizard,model_runbot_trigger_custom_wizard,runbot.group_runbot_admin,1,1,1,1 +access_runbot_trigger_custom_wizard,access_runbot_trigger_custom_wizard,model_runbot_trigger_custom_wizard,runbot.group_runbot_admin,1,1,1,1 -access_runbot_build_stat_regex_wizard,access_runbot_build_stat_regex_wizard,model_runbot_build_stat_regex_wizard,runbot.group_runbot_admin,1,1,1,1 +access_runbot_build_stat_regex_wizard,access_runbot_build_stat_regex_wizard,model_runbot_build_stat_regex_wizard,runbot.group_runbot_admin,1,1,1,1 diff --git a/runbot/templates/batch.xml b/runbot/templates/batch.xml index e8ade5d9..aac94875 100644 --- a/runbot/templates/batch.xml +++ b/runbot/templates/batch.xml @@ -143,7 +143,7 @@
-- - +
diff --git a/runbot/templates/build.xml b/runbot/templates/build.xml index 5e5b41cf..592b99bf 100644 --- a/runbot/templates/build.xml +++ b/runbot/templates/build.xml @@ -87,7 +87,7 @@ Description: - +
@@ -184,7 +184,7 @@ - + with config @@ -283,7 +283,7 @@ - +
@@ -352,7 +352,7 @@ - + diff --git a/runbot/templates/build_stats.xml b/runbot/templates/build_stats.xml index 4a990e1b..2e257921 100644 --- a/runbot/templates/build_stats.xml +++ b/runbot/templates/build_stats.xml @@ -11,7 +11,7 @@ Build:
Description: - +
Date:
diff --git a/runbot/templates/dockerfile.xml b/runbot/templates/dockerfile.xml index 7214ce8e..0c59d530 100644 --- a/runbot/templates/dockerfile.xml +++ b/runbot/templates/dockerfile.xml @@ -135,7 +135,7 @@ RUN -m pip install --no-cache-dir setuptoo - + diff --git a/runbot/templates/nginx.xml b/runbot/templates/nginx.xml index 0b5151f3..64d0661b 100644 --- a/runbot/templates/nginx.xml +++ b/runbot/templates/nginx.xml @@ -54,14 +54,14 @@ server { server { listen 8080; - server_name ~^(-[a-z0-9_]+)?\.$; + server_name ~^(-[a-z0-9_]+)?\.$; location / { proxy_pass http://127.0.0.1:; } location /longpolling { proxy_pass http://127.0.0.1:; } } server { listen 8080; - server_name ~.+\.$; + server_name ~.+\.$; location / { return 404; } } } diff --git a/runbot/templates/utils.xml b/runbot/templates/utils.xml index ad97ddb7..96105dd0 100644 --- a/runbot/templates/utils.xml +++ b/runbot/templates/utils.xml @@ -23,7 +23,7 @@ - + @@ -126,12 +126,12 @@ - + - + diff --git a/runbot/views/assets.xml b/runbot/views/assets.xml deleted file mode 100644 index f300b028..00000000 --- a/runbot/views/assets.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - \ No newline at end of file diff --git a/runbot_merge/views/templates.xml b/runbot_merge/views/templates.xml index 49e475b3..c3fcbac4 100644 --- a/runbot_merge/views/templates.xml +++ b/runbot_merge/views/templates.xml @@ -311,7 +311,7 @@

  • - +
@@ -436,4 +436,3 @@ -