Fill second_currency when amount_second_currency is set

issue10916
review389191002
This commit is contained in:
Cédric Krier committed 2021-10-31 10:30:52 +01:00
1 parent 8f8eb6d8d1
commit 88c21c2fea
1 file changed
+3
+3
View File
@@ -168,10 +168,12 @@ class Invoice(metaclass=PoolMeta):
config = Configuration(1)
total = Decimal(0)
total_currency = Decimal(0)
second_currency = None
for line in move.lines:
total += line.debit - line.credit
if line.amount_second_currency:
total_currency += line.amount_second_currency
second_currency = line.second_currency
if total or total_currency:
line = MoveLine()
if total <= 0:
@@ -191,6 +193,7 @@ class Invoice(metaclass=PoolMeta):
'.msg_missing_cash_rounding_account'))
if total_currency:
line.amount_second_currency = total_currency
line.second_currency = second_currency
lines = list(move.lines)
lines.append(line)
move.lines = lines