[document_page_approval] Allow to quickly cancel&draft from 'to approve' state

This commit is contained in:
Iván Todorovich 2018-04-24 20:07:07 -03:00
parent dce03abb17
commit 3a142e7ba2
2 changed files with 9 additions and 0 deletions

View File

@ -139,6 +139,12 @@ class DocumentPageHistory(models.Model):
) % (rec.display_name, self.env.user.name)
)
@api.multi
def action_cancel_and_draft(self):
"""Set a change request as draft, cancelling it first"""
self.action_cancel()
self.action_draft()
@api.multi
def _compute_am_i_owner(self):
"""Check if current user is the owner"""

View File

@ -24,6 +24,9 @@
<!-- reopen if i am owner or approver -->
<button name="action_draft" type="object" string="Back to draft"
attrs="{'invisible':['|','&amp;',('am_i_owner','=',False),('am_i_approver','=',False),('state','not in',['cancelled'])]}"/>
<!-- cancel & reopen, if i am owner or approver -->
<button name="action_draft" type="object" string="Back to draft"
attrs="{'invisible':['|','&amp;',('am_i_owner','=',False),('am_i_approver','=',False),('state','not in',['to approve'])]}"/>
<field name="am_i_owner" invisible="1"/>
<field name="am_i_approver" invisible="1"/>
<field name="is_approval_required" invisible="1"/>