From 5ffc7c63281ca4cc7116d339f27d2509192c5576 Mon Sep 17 00:00:00 2001 From: mreficent <miquel.raich@eficent.com> Date: Mon, 25 Oct 2021 16:59:57 +0000 Subject: [PATCH] [FIX] l10n_es: check if chart of account is installed in migration In last added migration script in https://github.com/odoo/odoo/commit/b40216a8ae8fefd03311b2884e7b83644baac0a1, the code assumes the chart of account of l10n_es is installed. But happens that you may have installed several l10n_* modules, including l10n_es, but not having the chart of l10n_es installed (you have installed the chart of another module). In this case, then the update crashes because tax_ids is None and tuple(tax_ids) crashes! closes odoo/odoo#79024 X-original-commit: f5b21797b54e2dadd8c5940a0cb2e4b26ca47364 Signed-off-by: Olivier Colson <oco@odoo.com> --- .../l10n_es/upgrades/14.0.5.0/post-61-tag-split-2021.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/l10n_es/upgrades/14.0.5.0/post-61-tag-split-2021.py b/addons/l10n_es/upgrades/14.0.5.0/post-61-tag-split-2021.py index b785b125b096..d8aa69567df3 100644 --- a/addons/l10n_es/upgrades/14.0.5.0/post-61-tag-split-2021.py +++ b/addons/l10n_es/upgrades/14.0.5.0/post-61-tag-split-2021.py @@ -29,10 +29,11 @@ def migrate(cr, version): # To run in a server action to fix issues on dbs with custom taxes, # replace the content of this dict. - taxes_mapping = { - tag_name: get_taxes_from_templates(template_names) - for tag_name, template_names in templates_mapping.items() - } + taxes_mapping = {} + for tag_name, template_names in templates_mapping.items(): + taxes_from_templates = get_taxes_from_templates(template_names) + if taxes_from_templates: + taxes_mapping[tag_name] = taxes_from_templates old_tag = env.ref('l10n_es.mod_303_61') for tag_name, tax_ids in taxes_mapping.items(): -- GitLab