diff --git a/addons/account/models/chart_template.py b/addons/account/models/chart_template.py index 03ef0d207644a9d56bf4b215a52a8072ee13b1d6..5b0ce9392adefbbdbee051930ac3e34f2125026d 100644 --- a/addons/account/models/chart_template.py +++ b/addons/account/models/chart_template.py @@ -160,6 +160,8 @@ def update_taxes_from_templates(cr, chart_template_xmlid): Those languages are the intersection of the spoken_languages of the chart_template and installed languages. """ + if not new_template_x_taxes: + return langs = chart_template._get_langs() if langs: template_ids, tax_ids = zip(*new_template_x_taxes) diff --git a/addons/l10n_ch/migrations/11.1/end-migrate_update_taxes.py b/addons/l10n_ch/migrations/11.1/end-migrate_update_taxes.py index 81d93b5b9af1d84296b29cde3afb5edcfc83068c..f79ddef3f31b0045d5d52cb764d302d90d12d079 100644 --- a/addons/l10n_ch/migrations/11.1/end-migrate_update_taxes.py +++ b/addons/l10n_ch/migrations/11.1/end-migrate_update_taxes.py @@ -5,6 +5,7 @@ from odoo.addons.account.models.chart_template import update_taxes_from_template def migrate(cr, version): new_template_to_tax = update_taxes_from_templates(cr, 'l10n_ch.l10nch_chart_template') - _, new_tax_ids = zip(*new_template_to_tax) - env = api.Environment(cr, SUPERUSER_ID, {}) - env['account.tax'].browse(new_tax_ids).active = True + if new_template_to_tax: + _, new_tax_ids = zip(*new_template_to_tax) + env = api.Environment(cr, SUPERUSER_ID, {}) + env['account.tax'].browse(new_tax_ids).active = True