From 82249b1c041105fbb4b24189ec02da2e3c345666 Mon Sep 17 00:00:00 2001 From: jbw-odoo Date: Fri, 28 Oct 2022 12:49:09 +0000 Subject: [PATCH] [FIX] account_edi: tax round globally MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevent "per line" rounding taxes when tax rounding method is round globally. Manual fwd port of https://github.com/odoo/odoo/commit/46504495664be211cf2ddbf2fa7532c022b1e5f0 closes odoo/odoo#105662 Task: opw-2963947 X-original-commit: c2b8ab136a5df4d70274d4abc5ceb14fa88b4149 Signed-off-by: Laurent Smet Signed-off-by: de Wouters de Bouchout Jean-BenoƮt (jbw) --- addons/account/models/account_tax.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_tax.py b/addons/account/models/account_tax.py index 7439f3aee04..e8e51c9dddf 100644 --- a/addons/account/models/account_tax.py +++ b/addons/account/models/account_tax.py @@ -862,6 +862,9 @@ class AccountTax(models.Model): tax_values_list = [] for tax_res in taxes_res['taxes']: + tax_amount = tax_res['amount'] / rate + if self.company_id.tax_calculation_rounding_method == 'round_per_line': + tax_amount = currency.round(tax_amount) tax_rep = self.env['account.tax.repartition.line'].browse(tax_res['tax_repartition_line_id']) tax_values_list.append({ **tax_res, @@ -869,7 +872,7 @@ class AccountTax(models.Model): 'base_amount_currency': tax_res['base'], 'base_amount': currency.round(tax_res['base'] / rate), 'tax_amount_currency': tax_res['amount'], - 'tax_amount': currency.round(tax_res['amount'] / rate), + 'tax_amount': tax_amount, }) else: