From 562e2657f6ae2cac5f09d18b91cb65839dca5edc Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 10 Jan 2017 17:15:48 +0100 Subject: [PATCH] [FIX] account: invoices on unmatched payment Fine tuning of this commit: 69c41c7 When cancelling a payment, the remove_move_reconcile function was called and it removed the payment from the invoice and in the payment history, only the validated payments were kept. This commit keeps the behavior before this commit: 69c41c7 opw:691692 --- addons/account/models/account_move.py | 2 +- addons/account/static/src/js/account_payment_widget.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 0f953eb4a9d..c1406a2e15f 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -991,7 +991,7 @@ class AccountMoveLine(models.Model): 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: + if invoice.id == self.env.context.get('invoice_id') and 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 diff --git a/addons/account/static/src/js/account_payment_widget.js b/addons/account/static/src/js/account_payment_widget.js index 932de22eef5..a7f2b64c413 100644 --- a/addons/account/static/src/js/account_payment_widget.js +++ b/addons/account/static/src/js/account_payment_widget.js @@ -59,7 +59,7 @@ var ShowPaymentLineWidget = form_common.AbstractField.extend({ var payment_id = parseInt($(this).attr('payment-id')) if (payment_id !== undefined && payment_id !== NaN){ new Model("account.move.line") - .call("remove_move_reconcile", [payment_id]) + .call("remove_move_reconcile", [payment_id, {'invoice_id': self.view.datarecord.id}]) .then(function (result) { self.view.reload(); });