From 084baefb22518e083d5015ae811bbbb39a4675ee Mon Sep 17 00:00:00 2001 From: "Claire Bretton (clbr)" Date: Wed, 28 Jun 2023 09:38:42 +0000 Subject: [PATCH] [FIX] account,l10n_es: revert commit cf00ac4be7cd8f936803dde75966203191b37ed8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We chose a different solution to handle default chart_template. This is more robust and explicit since we define a sequence on chart_template, instead of relying on import order. New solution commit: https://github.com/odoo/odoo/commit/41794859a85bacbf16604ffd37c7f1b0a358e196 Old solution commit: https://github.com/odoo/odoo/commit/cf00ac4be7cd8f936803dde75966203191b37ed8 opw-3329987 closes odoo/odoo#126649 Signed-off-by: William André (wan) Signed-off-by: Claire Bretton (clbr) --- addons/account/models/ir_module.py | 7 ++----- addons/l10n_es/models/__init__.py | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/addons/account/models/ir_module.py b/addons/account/models/ir_module.py index bbc0b58b021..48adb7bd55d 100644 --- a/addons/account/models/ir_module.py +++ b/addons/account/models/ir_module.py @@ -1,5 +1,5 @@ from importlib import import_module -from inspect import getmembers, ismodule, isclass, isfunction, getsourcelines +from inspect import getmembers, ismodule, isclass, isfunction from odoo import api, models, fields from odoo.tools import get_flag @@ -37,9 +37,6 @@ class IrModule(models.Model): except ModuleNotFoundError: templates = {} else: - #This will allow to get the order of the init file, This will be useful for locations with several - #templates, one or more of which you want to prioritize. - module_order = {w: i for i, w in enumerate(''.join(getsourcelines(python_module)[0]).split())} templates = { fct._l10n_template[0]: { 'name': fct(ChartTemplate).get('name'), @@ -50,7 +47,7 @@ class IrModule(models.Model): 'installed': module.state == "installed", 'module': module.name, } - for _name, mdl in sorted(getmembers(python_module, template_module), key=(lambda mdl: module_order[mdl[0]])) + for _name, mdl in getmembers(python_module, template_module) for _name, cls in getmembers(mdl, template_class) for _name, fct in getmembers(cls, template_function) } diff --git a/addons/l10n_es/models/__init__.py b/addons/l10n_es/models/__init__.py index 3a3ab2e6bd6..8f036bfc74b 100644 --- a/addons/l10n_es/models/__init__.py +++ b/addons/l10n_es/models/__init__.py @@ -1,5 +1,5 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. -from . import template_es_pymes -from . import template_es_full from . import template_es_assec from . import template_es_common +from . import template_es_full +from . import template_es_pymes