From 69c41c7e3c2dd46080c259613b28e1f5eeb9e22f Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 26 Oct 2016 11:11:06 +0200 Subject: [PATCH] [FIX] account: invoices on unmatched payment When unreconciling a payment from an invoice, the link between the payment and the invoice (in many2many invoice_ids)was kept and then the invoice still appeared when clicking on the button invoices in the payment form view. The invoice must be removed from invoice_ids. opw:691692 --- addons/account/models/account_move.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 9bd24f3c94f..df2cc859baa 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -972,6 +972,9 @@ class AccountMoveLine(models.Model): return True rec_move_ids = self.env['account.partial.reconcile'] for account_move_line in self: + for invoice in account_move_line.payment_id.invoice_ids: + if account_move_line in invoice.payment_move_line_ids: + account_move_line.payment_id.write({'invoice_ids': [(3, invoice.id, None)]}) rec_move_ids += account_move_line.matched_debit_ids rec_move_ids += account_move_line.matched_credit_ids return rec_move_ids.unlink()