Fix computation of second currency amount

issue3664
review3351002
(transplanted from b81862858d215919a2c3355d4075c656e5ed516b)
This commit is contained in:
Cédric Krier
2014-02-10 22:28:29 +01:00
parent 29ce13f47f
commit d5a8cfb0a3
+2 -2
View File
@@ -862,11 +862,11 @@ class Invoice(ModelWorkflow, ModelSQL, ModelView):
remainder_total_currency = total_currency
for date, amount in term_lines:
val = self._get_move_line(invoice, date, amount)
remainder_total_currency -= val['amount_second_currency']
remainder_total_currency += val['amount_second_currency']
move_lines.append(val)
if not currency_obj.is_zero(invoice.currency,
remainder_total_currency):
move_lines[-1]['amount_second_currency'] += remainder_total_currency
move_lines[-1]['amount_second_currency'] -= remainder_total_currency
accounting_date = invoice.accounting_date or invoice.invoice_date
period_id = period_obj.find(invoice.company.id, date=accounting_date)