From c039064ca4a5f1cd2bbbd71131490efbbde96de5 Mon Sep 17 00:00:00 2001 From: Adesh Jolhe Date: Fri, 31 Mar 2023 12:56:52 +0000 Subject: [PATCH] [FIX] account: prevent traceback while reload template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a new tax is created and click on Reload button of fiscal Localization it will generate traceback. Steps to Produce:- - Create a new Tax. - Then open the setting of invoicing and Click on reload Button which is located inside fiscal Localization. - IndexError will be generated. Cause:- - When a user creates a tax from UI `get_external_id` return an empty string and we try to `spilt` an empty string and get 1 index value and because of that it gives traceback. Fix:- - Check xml_id is not null before trying to spilt and get the value from xml_id. Sentry-4042986115 closes odoo/odoo#117709 X-original-commit: 3b86115d5f989c3b35579e75c67d94d120ef6be2 Signed-off-by: William André (wan) --- addons/account/models/chart_template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/chart_template.py b/addons/account/models/chart_template.py index 040e3fa0845..57e0938dd38 100644 --- a/addons/account/models/chart_template.py +++ b/addons/account/models/chart_template.py @@ -235,7 +235,7 @@ class AccountChartTemplate(models.AbstractModel): unique_tax_name_keys = set(current_taxes.mapped(unique_tax_name_key)) xmlid2tax = { xml_id.split('.')[1].split('_', maxsplit=1)[1]: self.env['account.tax'].browse(record) - for record, xml_id in current_taxes.get_external_id().items() + for record, xml_id in current_taxes.get_external_id().items() if xml_id } def tax_template_changed(tax, template): return (