Use the total amount of the invoice as second currency total

issue10923
review381341002
(grafted from 445db5742671487d6179237bf4c7c21c0d1017b6)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier committed 2021-10-31 10:27:03 +01:00
1 parent d83f5e467d
commit a0003e7f09
1 file changed
+7 -9
+7 -9
View File
@@ -985,19 +985,17 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin):
for tax in self.taxes:
move_lines += tax.get_move_lines()
total = Decimal('0.0')
total_currency = Decimal('0.0')
for line in move_lines:
total += line.debit - line.credit
if line.amount_second_currency:
total_currency += line.amount_second_currency
term_lines = [(self.payment_term_date or today, total)]
total = sum(l.debit - l.credit for l in move_lines)
if self.payment_term:
payment_date = self.payment_term_date or self.invoice_date
term_lines = self.payment_term.compute(
total, self.company.currency, payment_date)
remainder_total_currency = total_currency
else:
term_lines = [(self.payment_term_date or today, total)]
if self.currency != self.company.currency:
remainder_total_currency = -self.total_amount
else:
remainder_total_currency = 0
for date, amount in term_lines:
if self.type == 'out' and date < today:
lang = Lang.get()