[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:
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user