From d402aaf364906d71fb3f102515451b0a70ea4e5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 26 Jul 2016 23:05:20 +0200 Subject: [PATCH] Remove code to compute amount_writeoff in default_ask Indeed we can rely on the client calling the on_change_lines to compute and update the amount_writeoff. issue4917 review29401002 --- invoice.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/invoice.py b/invoice.py index 839668b0d8..8215581ec1 100644 --- a/invoice.py +++ b/invoice.py @@ -2517,7 +2517,6 @@ class PayInvoice(Wizard): pool = Pool() Invoice = pool.get('account.invoice') Currency = pool.get('currency.currency') - Line = pool.get('account.move.line') default = {} invoice = Invoice(Transaction().context['active_id']) @@ -2546,16 +2545,6 @@ class PayInvoice(Wizard): default['payment_lines'] = [x.id for x in invoice.payment_lines if not x.reconciliation] - default['amount_writeoff'] = Decimal('0.0') - for line in Line.browse(default['lines']): - default['amount_writeoff'] += line.debit - line.credit - for line in Line.browse(default['payment_lines']): - default['amount_writeoff'] += line.debit - line.credit - if invoice.type == 'in': - default['amount_writeoff'] = - default['amount_writeoff'] - amount - else: - default['amount_writeoff'] = default['amount_writeoff'] - amount - default['currency_writeoff'] = invoice.company.currency.id default['currency_digits_writeoff'] = invoice.company.currency.digits default['invoice'] = invoice.id