Quantize to number of digits instead of rounding computed amount
Rounding may change the result if currency rounding is not unitary. issue7284 review41251002
This commit is contained in:
1 parent
ae1473d35a
commit
967c06a3a6
1 file changed
+5
-3
+5
-3
@@ -227,7 +227,8 @@ class Account(DeactivableMixin, ModelSQL, ModelView):
|
||||
balance += account_sum[child.id]
|
||||
if account.display_balance == 'credit-debit' and balance:
|
||||
balance *= -1
|
||||
balances[account.id] = account.currency.round(balance)
|
||||
exp = Decimal(str(10.0 ** -account.currency_digits))
|
||||
balances[account.id] = balance.quantize(exp)
|
||||
return balances
|
||||
|
||||
@classmethod
|
||||
@@ -275,8 +276,9 @@ class Account(DeactivableMixin, ModelSQL, ModelView):
|
||||
result[name][account_id] += value
|
||||
for account in accounts:
|
||||
for name in names:
|
||||
result[name][account.id] = account.currency.round(
|
||||
result[name][account.id])
|
||||
exp = Decimal(str(10.0 ** -account.currency_digits))
|
||||
result[name][account.id] = (
|
||||
result[name][account.id].quantize(exp))
|
||||
return result
|
||||
|
||||
def get_rec_name(self, name):
|
||||
|
||||
Reference in new issue
Block a user