details: https://code.tryton.org/tryton/commit/2d90789f1705
branch: 7.0
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
(grafted from c2e82186e7089618939ae9270490a68d2ca17622)
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 8141649d7af5 -r 2d90789f1705 modules/account_cash_rounding/currency.py
--- a/modules/account_cash_rounding/currency.py Mon Mar 09 10:54:45 2026 +0100
+++ b/modules/account_cash_rounding/currency.py Mon Mar 02 15:23:13 2026 +0100
@@ -15,4 +15,8 @@
digits=(12, Eval('digits', 6)))
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 8141649d7af5 -r 2d90789f1705
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:54:45 2026 +0100
+++
b/modules/account_cash_rounding/tests/scenario_account_cash_rounding_alternate_currency.rst
Mon Mar 02 15:23:13 2026 +0100
@@ -98,6 +98,6 @@
>>> line_to_pay, = invoice.lines_to_pay
>>> line_to_pay.debit, line_to_pay.credit
- (Decimal('21.03'), Decimal('0'))
+ (Decimal('21.03'), Decimal('0.00'))
>>> line_to_pay.amount_second_currency
Decimal('42.05')