[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
This commit is contained in:
Goffin Simon
2017-01-11 13:56:12 +01:00
parent 291a94192c
commit 562e2657f6
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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
@@ -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();
});