OpenUpgrade
OpenUpgrade copied to clipboard
[16.0 -> 17.0] l10n_es: ERROR devel odoo.modules.registry: Failed to load registry KeyError: 'es_common'
Upgrading to v17 from v16 I got below error. I'm aware several of my colleagues have upgraded with no problems l10n_es but ...
I fixed the problem with BinhexTeam/OpenUpgrade@4f072c8 but I'm no sure if I should create a PR, maybe is just with this instance. I have been upgrading step by step from v10.
Module
l10n_es
Describe the bug
2025-02-25 19:57:01,689 1 INFO devel odoo.modules.migration: module l10n_es: Running migration [$5.4] end-migrate
2025-02-25 19:57:01,843 1 WARNING devel odoo.modules.loading: Transient module states were reset
2025-02-25 19:57:01,846 1 ERROR devel odoo.modules.registry: Failed to load registry
Traceback (most recent call last):
File "/opt/odoo/custom/src/odoo/odoo/modules/registry.py", line 110, in new
odoo.modules.load_modules(registry, force_demo, status, update_module)
File "/opt/odoo/custom/src/odoo/odoo/modules/loading.py", line 515, in load_modules
migrations.migrate_module(package, 'end')
File "/opt/odoo/auto/addons/openupgrade_framework/odoo_patch/odoo/modules/migration.py", line 18, in migrate_module
MigrationManager.migrate_module._original_method(self, pkg, stage)
File "/opt/odoo/custom/src/odoo/odoo/modules/migration.py", line 240, in migrate_module
migrate(self.cr, installed_version)
File "/opt/odoo/auto/addons/l10n_es/migrations/5.4/end-migrate.py", line 7, in migrate
env['account.chart.template'].try_loading(company.chart_template, company)
File "/opt/odoo/auto/addons/account/models/chart_template.py", line 155, in try_loading
return self._load(template_code, company, install_demo)
File "/opt/odoo/auto/addons/account/models/chart_template.py", line 170, in _load
chart_template_mapping = self._get_chart_template_mapping()[template_code]
KeyError: 'es_common'
2025-02-25 19:57:01,847 1 CRITICAL devel odoo.service.server: Failed to initialize database `devel`.
Traceback (most recent call last):
File "/opt/odoo/custom/src/odoo/odoo/service/server.py", line 1326, in preload_registries
registry = Registry.new(dbname, update_module=update_module)
File "<decorator-gen-16>", line 2, in new
File "/opt/odoo/custom/src/odoo/odoo/tools/func.py", line 87, in locked
return func(inst, *args, **kwargs)
File "/opt/odoo/custom/src/odoo/odoo/modules/registry.py", line 110, in new
odoo.modules.load_modules(registry, force_demo, status, update_module)
File "/opt/odoo/custom/src/odoo/odoo/modules/loading.py", line 515, in load_modules
migrations.migrate_module(package, 'end')
File "/opt/odoo/auto/addons/openupgrade_framework/odoo_patch/odoo/modules/migration.py", line 18, in migrate_module
MigrationManager.migrate_module._original_method(self, pkg, stage)
File "/opt/odoo/custom/src/odoo/odoo/modules/migration.py", line 240, in migrate_module
migrate(self.cr, installed_version)
File "/opt/odoo/auto/addons/l10n_es/migrations/5.4/end-migrate.py", line 7, in migrate
env['account.chart.template'].try_loading(company.chart_template, company)
File "/opt/odoo/auto/addons/account/models/chart_template.py", line 155, in try_loading
return self._load(template_code, company, install_demo)
File "/opt/odoo/auto/addons/account/models/chart_template.py", line 170, in _load
chart_template_mapping = self._get_chart_template_mapping()[template_code]
KeyError: 'es_common'
To Reproduce
Affected versions: Upgrading to v17 from v16
Steps to reproduce the behavior: This is on a real customer database. Upgrading step by step. Original version was v10. The instance has really very few customization or OCA addons.
Expected behavior Upgrade goes ok
Additional context Doodba copier template project settle up to upgrade to v17.
I was really running the relevant migration script as part of a click-odoo script. Testing now as an openupgrade script the error still raises. Maybe related to the use of cache in https://github.com/odoo/odoo/blob/8b0dddf8b4fb68fc12f15a71e150cf1607d5cd24/addons/account/models/chart_template.py#L100. Anyway I'm leaving this open for future references.
l10n_es migration scripts are still pending to be developed. The XML-ID renaming you are proposing may be needed, but probably not only that.
Testing #4795
Hello @rrebollo, I believe this issue is occurring because the database has assigned the es_common chart of accounts, which isn't selectable in 17.0. This might be due to older versions lacking control over this setting. I'm not sure if this is a common occurrence or if it’s specific to a particular previous version.
Closing as explained by previous comment.