From 6abb64fa89d1a872c9b44059266dbffce98d9e25 Mon Sep 17 00:00:00 2001 From: lse-odoo Date: Fri, 28 Feb 2025 18:12:02 +0100 Subject: [PATCH] [IMP] runbot: add kanban view and stages to build error page Introduce a kanban view to the runbot build error records. Kanban cards show the most valuable field with relevant icons. The concept of "state" was also introduced for the build error model. Currently there is 4 states: 1. New: default state for any new error build 2. Solved: when the issue should be solved 3. Ignored: build error currently ignored (test-tags) 4. Done: When the issue stop happening Certain states change automatically based as handled in a cron Generally, any not-ignored on-going task end up in done after some period of time if it is not seen for some time ( see full details in function `_update_stage`). The other state are expected to be used by the user. For instance after fixing an underteministic error the user can change the state from new -> solved so that it is moved to done if the build error is not seen for 7 days (instead of 15 if it was in new). --- runbot/__manifest__.py | 2 +- runbot/migrations/18.0.5.11/post-migration.py | 14 +++++ runbot/models/build_error.py | 18 ++++++ runbot/views/build_error_views.xml | 58 ++++++++++++++++++- 4 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 runbot/migrations/18.0.5.11/post-migration.py diff --git a/runbot/__manifest__.py b/runbot/__manifest__.py index 84d15e5d..ebccf5ce 100644 --- a/runbot/__manifest__.py +++ b/runbot/__manifest__.py @@ -6,7 +6,7 @@ 'author': "Odoo SA", 'website': "http://runbot.odoo.com", 'category': 'Website', - 'version': '5.10', + 'version': '5.11', 'application': True, 'depends': ['base', 'base_automation', 'website'], 'data': [ diff --git a/runbot/migrations/18.0.5.11/post-migration.py b/runbot/migrations/18.0.5.11/post-migration.py new file mode 100644 index 00000000..d9768e1a --- /dev/null +++ b/runbot/migrations/18.0.5.11/post-migration.py @@ -0,0 +1,14 @@ + +def migrate(cr, version): + # Archived build errors are considered solved + cr.execute(""" + UPDATE runbot_build_error + SET state = 'solved' + WHERE active = false + """) + # Build errors with test_tags are considered ignored + cr.execute(""" + UPDATE runbot_build_error + SET state = 'ignored' + WHERE test_tags is not null + """) diff --git a/runbot/models/build_error.py b/runbot/models/build_error.py index c2eccda4..5342cc6d 100644 --- a/runbot/models/build_error.py +++ b/runbot/models/build_error.py @@ -105,6 +105,15 @@ class BuildError(models.Model): error_count = fields.Integer("Error count", store=True, compute='_compute_count') previous_error_id = fields.Many2one('runbot.build.error', string="Already seen error") + state = fields.Selection([ + ('new', 'New/Unsolved'), + ('solved', 'Solved'), + ('ignored', 'Ignored'), + ], default='new', tracking=True, group_expand=True, + help="New: Error is new and not yet solved.\n" + "Solved: Error should be solved.\n" + "Ignored: Error is ignored" + ) responsible = fields.Many2one('res.users', 'Assigned fixer', tracking=True) customer = fields.Many2one('res.users', 'Customer', tracking=True) team_id = fields.Many2one('runbot.team', 'Assigned team', tracking=True) @@ -586,6 +595,15 @@ class BuildError(models.Model): base_error = self_sorted[0] base_error._merge(self_sorted - base_error) + @api.model + def _read_group_fill_results(self, domain, groupby, annoted_aggregates, read_group_result, read_group_order=None): + # Override to fold ignored state + read_groups = super()._read_group_fill_results(domain, groupby, annoted_aggregates, read_group_result, read_group_order) + for read_group in read_groups: + if read_group.get('state', False) == 'ignored': + read_group['__fold'] = True + return read_groups + class BuildErrorContent(models.Model): diff --git a/runbot/views/build_error_views.xml b/runbot/views/build_error_views.xml index b1c30c92..da1e6c92 100644 --- a/runbot/views/build_error_views.xml +++ b/runbot/views/build_error_views.xml @@ -5,6 +5,9 @@ runbot.build.error
+
+ +