diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py
index e21847878e2..1bc39562f77 100644
--- a/addons/account/models/account_payment.py
+++ b/addons/account/models/account_payment.py
@@ -192,7 +192,7 @@ class account_payment(models.Model):
company_id = fields.Many2one(store=True)
name = fields.Char(readonly=True, copy=False, default="Draft Payment") # The name is attributed upon post()
- state = fields.Selection([('draft', 'Draft'), ('posted', 'Posted'), ('sent', 'Sent'), ('reconciled', 'Reconciled')], readonly=True, default='draft', copy=False, string="Status")
+ state = fields.Selection([('draft', 'Draft'), ('posted', 'Posted'), ('sent', 'Sent'), ('reconciled', 'Reconciled'), ('cancel', 'Cancelled')], readonly=True, default='draft', copy=False, string="Status")
payment_type = fields.Selection(selection_add=[('transfer', 'Internal Transfer')])
payment_reference = fields.Char(copy=False, readonly=True, help="Reference of the document used to issue this payment. Eg. check number, file name, etc.")
@@ -315,7 +315,7 @@ class account_payment(models.Model):
move.line_ids.remove_move_reconcile()
move.button_cancel()
move.unlink()
- rec.state = 'draft'
+ rec.state = 'cancel'
@api.multi
def unlink(self):
@@ -370,6 +370,10 @@ class account_payment(models.Model):
rec.write({'state': 'posted', 'move_name': move.name})
+ @api.multi
+ def action_draft(self):
+ return self.write({'state': 'draft'})
+
def _create_payment_entry(self, amount):
""" Create a journal entry corresponding to a payment, if the payment references invoice(s) they are reconciled.
Return the journal entry.
diff --git a/addons/account/views/account_payment_view.xml b/addons/account/views/account_payment_view.xml
index a14c4c73ffa..8602bb3727a 100644
--- a/addons/account/views/account_payment_view.xml
+++ b/addons/account/views/account_payment_view.xml
@@ -6,7 +6,7 @@
account.payment.tree
account.payment
-
+
@@ -25,7 +25,7 @@
account.supplier.payment.tree
account.payment
-
+
@@ -76,6 +76,7 @@