From 12dad005089d158df7d03361ea13dd1186b487c0 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Tue, 8 Dec 2015 10:17:43 +0100 Subject: [PATCH] [FIX] account: fix problem with round_globally method in tax calculation When rounding globally, we should not round the tax with the currency rounding since it might introduce some errors. Also add the field on the company view for user to change the computation method as they want. --- addons/account/models/account.py | 5 ++++- addons/account/views/company_view.xml | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account.py b/addons/account/models/account.py index 7bf41e6ed3f..7c88e088c14 100644 --- a/addons/account/models/account.py +++ b/addons/account/models/account.py @@ -638,7 +638,10 @@ class AccountTax(models.Model): continue tax_amount = tax._compute_amount(base, price_unit, quantity, product, partner) - tax_amount = currency.round(tax_amount) + if company_id.tax_calculation_rounding_method == 'round_globally': + tax_amount = round(tax_amount, prec) + else: + tax_amount = currency.round(tax_amount) if tax_amount: if tax.price_include: diff --git a/addons/account/views/company_view.xml b/addons/account/views/company_view.xml index 06e1648b4a3..fe6bebbd2fa 100644 --- a/addons/account/views/company_view.xml +++ b/addons/account/views/company_view.xml @@ -13,6 +13,7 @@ +