[FIX] account: refunding an invoice with two payment terms

Step to reproduce the bug:

1) Create a payment term with two separated due type:
-Due type 1: percent , value 30, numbers of days: 0 days after the invoice date
-Due type 2: Balance; value 0, Number of days 0: Last day of following month
2) Create an invoice with the payment term
3) Refund the invoice with the option "cancel: create refund and reconcile"
or "Modify: create refund, reconcile and create a new draft invoice".
4) Error message: "You are trying to reconcile some entries that are already reconciled!"

But no payment had been received and the receivable accounts were still open.

opw:694386
This commit is contained in:
Goffin Simon
2016-12-15 16:00:35 +01:00
parent 3f375c9bbe
commit 35e66ec478
@@ -75,7 +75,7 @@ class AccountInvoiceRefund(models.TransientModel):
for tmpline in refund.move_id.line_ids:
if tmpline.account_id.id == inv.account_id.id:
to_reconcile_lines += tmpline
to_reconcile_lines.reconcile()
to_reconcile_lines.filtered(lambda l: l.reconciled == False).reconcile()
if mode == 'modify':
invoice = inv.read(
['name', 'type', 'number', 'reference',