diff --git a/modules/account_cash_rounding/currency.py b/modules/account_cash_rounding/currency.py index e890096db1..abe05f48f1 100644 --- a/modules/account_cash_rounding/currency.py +++ b/modules/account_cash_rounding/currency.py @@ -15,4 +15,8 @@ class Currency(metaclass=PoolMeta): 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 --git a/modules/account_cash_rounding/tests/scenario_account_cash_rounding_alternate_currency.rst b/modules/account_cash_rounding/tests/scenario_account_cash_rounding_alternate_currency.rst index e771e27331..c03a7f0469 100644 --- a/modules/account_cash_rounding/tests/scenario_account_cash_rounding_alternate_currency.rst +++ b/modules/account_cash_rounding/tests/scenario_account_cash_rounding_alternate_currency.rst @@ -98,6 +98,6 @@ Post invoice:: >>> 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')