From 3a9832d747f418c9e89c926d4a5b9eb65b4954a9 Mon Sep 17 00:00:00 2001 From: Christophe Monniez Date: Wed, 23 Nov 2022 10:45:40 +0100 Subject: [PATCH] [IMP] runbot: add a close error wizard When marking multiple build error as fixed, it's sometimes necessary to explain why it was decided to close the error. When working with a few errors, this can be done manually ... But most of the time we want to close a lot of false negatives in batch. With this commit, a simple wizard is made available that will post a reason in the chatter of the build_errors. --- runbot/models/build_error.py | 14 ++++++++++++++ runbot/security/ir.model.access.csv | 2 ++ runbot/views/build_error_views.xml | 28 ++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/runbot/models/build_error.py b/runbot/models/build_error.py index 7cf5a362..f5312196 100644 --- a/runbot/models/build_error.py +++ b/runbot/models/build_error.py @@ -247,3 +247,17 @@ class ErrorRegex(models.Model): if re.search(filter.regex, s): return True return False + + +class ErrorClosingWizard(models.TransientModel): + _name = 'runbot.error.closing.wizard' + _description = "Errors Closing Wizard" + + reason = fields.Char("Closing Reason", help="Reason that will appear in the chatter") + + def submit(self): + error_ids = self.env['runbot.build.error'].browse(self.env.context.get('active_ids')) + if error_ids: + for build_error in error_ids: + build_error.message_post(body=self.reason, subject="Closing Error") + error_ids['active'] = False diff --git a/runbot/security/ir.model.access.csv b/runbot/security/ir.model.access.csv index 04715daf..68ee1388 100644 --- a/runbot/security/ir.model.access.csv +++ b/runbot/security/ir.model.access.csv @@ -28,6 +28,8 @@ access_runbot_build_error_tag_manager,runbot_build_error_tag_manager,runbot.mode access_runbot_team_admin,runbot_team_admin,runbot.model_runbot_team,runbot.group_runbot_admin,1,1,1,1 access_runbot_team_team_manager,runbot_team_team_manager,runbot.model_runbot_team,runbot.group_runbot_team_manager,1,1,1,1 access_runbot_team_user,runbot_team_user,runbot.model_runbot_team,group_user,1,0,0,0 +access_runbot_error_closing_wizard_admin,access_runbot_error_closing_wizard_admin,runbot.model_runbot_error_closing_wizard,runbot.group_runbot_admin,1,1,1,1 +access_runbot_error_closing_wizard_manager,access_runbot_error_closing_wizard_manager,runbot.model_runbot_error_closing_wizard,runbot.group_runbot_error_manager,1,1,1,1 access_runbot_module_admin,runbot_module_admin,runbot.model_runbot_module,runbot.group_runbot_admin,1,1,1,1 access_runbot_module_team_manager,runbot_module_team_manager,runbot.model_runbot_module,runbot.group_runbot_team_manager,1,1,1,1 diff --git a/runbot/views/build_error_views.xml b/runbot/views/build_error_views.xml index 6165acdf..d0d326f4 100644 --- a/runbot/views/build_error_views.xml +++ b/runbot/views/build_error_views.xml @@ -204,5 +204,33 @@ tree,form + + runbot_error_closing_wizard + runbot.error.closing.wizard + +
+ + + + +
+
+
+
+
+
+ + + Close Errors With A Reason + runbot.error.closing.wizard + form + new + + + form,list + +