mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
Add back2draft on SEPA Direct Debit mandates (in case it was cancelled by mistake).
This commit is contained in:
@@ -314,6 +314,16 @@ class sdd_mandate(orm.Model):
|
||||
cr, uid, to_cancel_ids, {'state': 'cancel'}, context=context)
|
||||
return True
|
||||
|
||||
def back2draft(self, cr, uid, ids, context=None):
|
||||
to_draft_ids = []
|
||||
for mandate in self.browse(cr, uid, ids, context=context):
|
||||
assert mandate.state == 'cancel',\
|
||||
'Mandate should be in cancel state'
|
||||
to_draft_ids.append(mandate.id)
|
||||
self.write(
|
||||
cr, uid, to_draft_ids, {'state': 'draft'}, context=context)
|
||||
return True
|
||||
|
||||
def _sdd_mandate_set_state_to_expired(self, cr, uid, context=None):
|
||||
logger.info('Searching for SDD Mandates that must be set to Expired')
|
||||
expire_limit_date = datetime.today() + \
|
||||
|
||||
@@ -13,8 +13,11 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="SEPA Direct Debit Mandate" version="7.0">
|
||||
<header>
|
||||
<button name="validate" type="object" string="Validate" states="draft"/>
|
||||
<button name="validate" type="object" string="Validate" states="draft" class="oe_highlight"/>
|
||||
<button name="cancel" type="object" string="Cancel" states="draft,valid"/>
|
||||
<button name="back2draft" type="object" string="Back to Draft"
|
||||
states="cancel" groups="account.group_account_manager"
|
||||
confirm="You should set a mandate back to draft only if you cancelled it by mistake. Do you want to continue ?"/>
|
||||
<field name="state" widget="statusbar"/>
|
||||
</header>
|
||||
<sheet>
|
||||
|
||||
Reference in New Issue
Block a user