[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.
This commit is contained in:
Christophe Monniez 2022-11-23 10:45:40 +01:00 committed by xdo
parent 1e8e059734
commit 3a9832d747
3 changed files with 44 additions and 0 deletions

View File

@ -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

View File

@ -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

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
28 access_runbot_module_user access_runbot_module_admin runbot_module_user runbot_module_admin runbot.model_runbot_module group_user runbot.group_runbot_admin 1 0 1 0 1 0 1
29 access_runbot_module_ownership_admin access_runbot_module_team_manager runbot_module_ownership_admin runbot_module_team_manager runbot.model_runbot_module_ownership runbot.model_runbot_module runbot.group_runbot_admin runbot.group_runbot_team_manager 1 1 1 1
30 access_runbot_module_ownership__team_manager access_runbot_module_user runbot_module_ownership_team_manager runbot_module_user runbot.model_runbot_module_ownership runbot.model_runbot_module runbot.group_runbot_team_manager group_user 1 1 0 1 0 1 0
31 access_runbot_module_ownership_admin runbot_module_ownership_admin runbot.model_runbot_module_ownership runbot.group_runbot_admin 1 1 1 1
32 access_runbot_module_ownership__team_manager runbot_module_ownership_team_manager runbot.model_runbot_module_ownership runbot.group_runbot_team_manager 1 1 1 1
33 access_runbot_module_ownership_user runbot_module_ownership_user runbot.model_runbot_module_ownership group_user 1 0 0 0
34 access_runbot_dashboard_admin runbot_dashboard_admin runbot.model_runbot_dashboard runbot.group_runbot_admin 1 1 1 1
35 access_runbot_dashboard_user runbot_dashboard_user runbot.model_runbot_dashboard group_user 1 0 0 0

View File

@ -204,5 +204,33 @@
<field name="view_mode">tree,form</field>
</record>
<record model="ir.ui.view" id="runbot_error_closing_wizard_form">
<field name="name">runbot_error_closing_wizard</field>
<field name="model">runbot.error.closing.wizard</field>
<field name="arch" type="xml">
<form>
<sheet>
<group name="closing_group">
<field name="reason"/>
</group>
<footer>
<button string="Submit" name="submit" type="object" class="btn-primary"/>
<button string="Cancel" class="btn-secondary" special="cancel"/>
</footer>
</sheet>
</form>
</field>
</record>
<record id="runbot_open_error_closing_wizard" model="ir.actions.act_window">
<field name="name">Close Errors With A Reason</field>
<field name="res_model">runbot.error.closing.wizard</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="view_id" ref="runbot_error_closing_wizard_form"/>
<field name="binding_model_id" ref="runbot.model_runbot_build_error"/>
<field name="binding_view_types">form,list</field>
</record>
</data>
</odoo>