From c7b45078ac89a289ff9c3243014e50eea86093e9 Mon Sep 17 00:00:00 2001 From: David Harper Date: Fri, 28 Aug 2015 10:50:30 +0200 Subject: [PATCH] Fix calculation of displayed writeoff amount issue4917 review16541002 --- invoice.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/invoice.py b/invoice.py index 1fe37bcaff..14741bc565 100644 --- a/invoice.py +++ b/invoice.py @@ -2378,7 +2378,7 @@ class PayInvoiceAsk(ModelView): return 'partial' @fields.depends('lines', 'amount', 'currency', 'currency_writeoff', - 'invoice') + 'invoice', 'payment_lines') def on_change_lines(self): Currency = Pool().get('currency.currency') @@ -2389,6 +2389,8 @@ class PayInvoiceAsk(ModelView): self.amount_writeoff = Decimal('0.0') for line in self.lines: self.amount_writeoff += line.debit - line.credit + for line in self.payment_lines: + self.amount_writeoff += line.debit - line.credit if self.invoice.type in ('in_invoice', 'out_credit_note'): self.amount_writeoff = - self.amount_writeoff - amount else: