[ADD] runbot_merge: button to manually cancel stagings

This is somewhat less useful with runbot's fail-fast as a runbot
failure (false positive or not) will now very quickly trigger an end
to the current staging.

Still, could be of use.

closes #89
This commit is contained in:
Xavier Morel 2019-03-01 17:29:37 +01:00
parent eea3211f2b
commit c693a7f841
2 changed files with 36 additions and 1 deletions

View File

@ -1114,10 +1114,14 @@ class Stagings(models.Model):
s.state = st
def cancel(self, reason, *args):
@api.multi
def cancel(self, reason=None, *args):
if not self:
return
if reason is None:
reason = "explicitly cancelled by %s"
args = [self.env.user.display_name]
_logger.info("Cancelling staging %s: " + reason, self, *args)
self.batch_ids.write({'active': False})
self.write({

View File

@ -182,6 +182,37 @@
</tree>
</field>
</record>
<record id="runbot_merge_form_stagings" model="ir.ui.view">
<field name="name">Stagings Form</field>
<field name="model">runbot_merge.stagings</field>
<field name="arch" type="xml">
<form>
<header>
<button type="object" name="cancel" string="Cancel" class="oe_highlight"/>
</header>
<sheet>
<group>
<group>
<field name="target"/>
<field name="state"/>
<field name="reason"/>
</group>
<group>
<field name="staged_at"/>
<field name="statuses"/>
</group>
</group>
<group>
<field name="batch_ids" colspan="4">
<tree>
<field name="prs"/>
</tree>
</field>
</group>
</sheet>
</form>
</field>
</record>
<record id="runbot_merge_action_fetches" model="ir.actions.act_window">
<field name="name">PRs to fetch</field>