Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0 -> 17.0] l10n_es: ERROR devel odoo.modules.registry: Failed to load registry KeyError: 'es_common' #4774

Open
rrebollo opened this issue Feb 25, 2025 · 3 comments
Labels

Comments

@rrebollo
Copy link

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.

@rrebollo rrebollo added the bug label Feb 25, 2025
@rrebollo rrebollo changed the title [16.0 => 17.0] l10n-es: ERROR devel odoo.modules.registry: Failed to load registry KeyError: 'es_common' [16.0 => 17.0] l10n_es: ERROR devel odoo.modules.registry: Failed to load registry KeyError: 'es_common' Feb 25, 2025
@rrebollo rrebollo changed the title [16.0 => 17.0] l10n_es: ERROR devel odoo.modules.registry: Failed to load registry KeyError: 'es_common' [16.0 -> 17.0] l10n_es: ERROR devel odoo.modules.registry: Failed to load registry KeyError: 'es_common' Feb 25, 2025
@rrebollo
Copy link
Author

rrebollo commented Feb 26, 2025

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.

@pedrobaeza
Copy link
Member

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.

@rrebollo
Copy link
Author

rrebollo commented Mar 3, 2025

Probando #4795

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants