details:   https://code.tryton.org/tryton/commit/c2e82186e708
branch:    default
user:      Cédric Krier <[email protected]>
date:      Mon Mar 02 15:23:13 2026 +0100
description:
        Use currency rounding when currency has no cash rounding set

        Closes #14638
diffstat:

 modules/account_cash_rounding/currency.py                                      
           |  6 +++++-
 
modules/account_cash_rounding/tests/scenario_account_cash_rounding_alternate_currency.rst
 |  2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r d0d45b156198 -r c2e82186e708 modules/account_cash_rounding/currency.py
--- a/modules/account_cash_rounding/currency.py Mon Mar 09 10:55:14 2026 +0100
+++ b/modules/account_cash_rounding/currency.py Mon Mar 02 15:23:13 2026 +0100
@@ -15,4 +15,8 @@
         digits=(None, Eval('digits', None)))
 
     def cash_round(self, amount, rounding=ROUND_HALF_EVEN):
-        return self._round(amount, self.cash_rounding, rounding)
+        if self.cash_rounding is not None:
+            factor = self.cash_rounding
+        else:
+            factor = self.rounding
+        return self._round(amount, factor, rounding)
diff -r d0d45b156198 -r c2e82186e708 
modules/account_cash_rounding/tests/scenario_account_cash_rounding_alternate_currency.rst
--- 
a/modules/account_cash_rounding/tests/scenario_account_cash_rounding_alternate_currency.rst
 Mon Mar 09 10:55:14 2026 +0100
+++ 
b/modules/account_cash_rounding/tests/scenario_account_cash_rounding_alternate_currency.rst
 Mon Mar 02 15:23:13 2026 +0100
@@ -105,6 +105,6 @@
 
     >>> line_to_pay, = invoice.lines_to_pay
     >>> line_to_pay.debit, line_to_pay.credit
-    (Decimal('21.02'), Decimal('0'))
+    (Decimal('21.02'), Decimal('0.00'))
     >>> line_to_pay.amount_second_currency
     Decimal('42.05')

Reply via email to