Daily updates from Odoo
Wednesday, February 19, 2025
1 change
Resolved issues and error corrections
This fix prevents upgrades from failing when a Spanish tax report component is referenced before it has fully loaded. It helps customers with the Modelo 130 Spanish reporting module complete upgrades to version 18.0 without being blocked by a loading-order issue.
Original PR description
The custom handler for `l10n_es_modelo130` is [defined](https://github.com/odoo/enterprise/blob/22e11de8df9f8516d17b958079a8d8b67c304b50/l10n_es_reports_modelo130/models/aeat_tax_reports.py#L6-L9) in…
The custom handler for `l10n_es_modelo130` is [defined](https://github.com/odoo/enterprise/blob/22e11de8df9f8516d17b958079a8d8b67c304b50/l10n_es_reports_modelo130/models/aeat_tax_reports.py#L6-L9) in module `l10n_es_reports_modelo_130`. There is however [data](https://github.com/odoo/odoo/blob/18.0/addons/l10n_es_modelo130/data/mod130.xml#L4) that [uses](https://github.com/odoo/enterprise/blob/18.0/l10n_es_reports_modelo130/data/mod130.xml#L4-L5) that handler in module `l10n_es_modelo130`.
Because of the order in which modules are loaded during the upgrade, module `l10n_es_modelo130` is loaded after `account_reports` but before `l10n_es_modelo130_reports`. Therefore, when it loads it's still missing the handler class in env, but the validation from `account_reports` still takes place.
This blocks all the upgrades to 18.0 with `l10n_es_reports_modelo_130` installed.
```
File "/home/odoo/src/odoo/18.0/addons/account/models/account_report.py", line 382, in _compute_user_groupby
report_line._validate_groupby()
File "/home/odoo/src/enterprise/18.0/account_reports/models/account_report.py", line 6854, in _validate_groupby
report_line.report_id._check_groupby_fields(report_line.user_groupby)
File "/home/odoo/src/enterprise/18.0/account_reports/models/account_report.py", line 6394, in _check_groupby_fields
custom_groupby_map = self.env[custom_handler_name]._get_custom_groupby_map() if custom_handler_name else {}
File "/home/odoo/src/odoo/18.0/odoo/api.py", line 596, in __getitem__
return self.registry[model_name](self, (), ())
File "/home/odoo/src/odoo/18.0/odoo/modules/registry.py", line 240, in __getitem__
return self.models[model_name]
KeyError: 'l10n_es_modelo130.mod130.tax.report.handler'
```