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
This commit is contained in:
Cédric Krier committed 2016-07-26 23:05:20 +02:00
1 parent 7691b7c64c
commit d402aaf364
1 file changed
-11
-11
View File
@@ -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