changeset 14eb7ee05e0c in modules/account_cash_rounding:default
details: 
https://hg.tryton.org/modules/account_cash_rounding?cmd=changeset&node=14eb7ee05e0c
description:
        Fill second_currency when amount_second_currency is set

        issue10916
        review389191002
diffstat:

 account.py |  3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diffs (24 lines):

diff -r d7557a33425a -r 14eb7ee05e0c account.py
--- a/account.py        Sun Oct 31 10:29:23 2021 +0100
+++ b/account.py        Sun Oct 31 10:30:52 2021 +0100
@@ -168,10 +168,12 @@
             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 @@
                             '.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

Reply via email to