[FIX] account: cancelling a bank statement line linked to a payment SEPA or batch deposit should set it back to 'sent' state, not 'posted'.

This commit is contained in:
qdp-odoo
2016-07-13 10:00:07 +02:00
parent 0529a7f9ba
commit 2d91575b11
2 changed files with 12 additions and 1 deletions
@@ -442,7 +442,7 @@ class AccountBankStatementLine(models.Model):
moves_to_cancel.unlink()
if payment_to_unreconcile:
payment_to_unreconcile.write({'state': 'posted'})
payment_to_unreconcile.unreconcile()
####################################################
# Reconciliation interface methods
+11
View File
@@ -290,6 +290,17 @@ class account_payment(models.Model):
def button_dummy(self):
return True
@api.multi
def unreconcile(self):
""" Set back the payments in 'posted' or 'sent' state, without deleting the journal entries.
Called when cancelling a bank statement line linked to a pre-registered payment.
"""
for payment in self:
if payment.payment_reference:
payment.write({'state': 'sent'})
else:
payment.write({'state': 'posted'})
@api.multi
def cancel(self):
for rec in self: