Use currency rounding when currency has no cash rounding set

Closes #14638
This commit is contained in:
Cédric Krier
2026-03-02 15:23:13 +01:00
parent 549f37c82f
commit 709832c16b
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -15,4 +15,8 @@ class Currency(metaclass=PoolMeta):
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)
@@ -105,6 +105,6 @@ Post invoice::
>>> 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')