From 7fecf1704789af07e97f53ff30e93e0c001eb294 Mon Sep 17 00:00:00 2001 From: Benoit Socias Date: Wed, 29 Nov 2023 15:54:33 +0100 Subject: [PATCH] [FIX] website: enable pseudo configurator page in themes manifests When shapes were extracted to configurator snippets in [1], some configurator-specific snippets were created that do not appear on pages of the specific theme. Because in [2] the call to `_generate_primary_snippet_templates` is done on a full list of themes instead of only the installed ones, the problem was not noticed: if any theme defines a block, it's website-side configurator-specific template is generated. This is not the case during an upgrade: the templates are generated only for the installed themes. Because of this some "useless" configurator templates trigger an error when importing their XML definition because their parent template does not exist. This is fixed in design-themes by adding those templates in a pseudo page `_` in the `configurator_snippets` entry of each theme's manifest. This commit makes sure to not consider that `_` page name as an actual page name. In master, the templates will be removed instead. [1]: https://github.com/odoo/design-themes/commit/d206c119720d557c11320ebb3d7339890b8f9efa [2]: https://github.com/odoo/odoo/commit/928eeca714a161f6bc03343e4dc8af9b050b9841#diff-f49a1e9eda23df9f1d48121ba376a5fabafe70ea18b29d4eab23d737e5d4eeb6R446 Part-of: odoo/odoo#144222 --- addons/website/models/ir_module_module.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/website/models/ir_module_module.py b/addons/website/models/ir_module_module.py index 74fa2e93b67..2aee69b2f7c 100644 --- a/addons/website/models/ir_module_module.py +++ b/addons/website/models/ir_module_module.py @@ -442,6 +442,8 @@ class IrModuleModule(models.Model): ], order='name') for theme in themes: + # TODO In master, only generate templates for installed themes. + # if theme.state != 'uninstalled': theme._generate_primary_snippet_templates() terp = self.get_module_info(theme.name) images = terp.get('images', []) @@ -675,6 +677,9 @@ class IrModuleModule(models.Model): # Generate configurator snippet templates for specific pages create_values = [] for page_name in configurator_snippets: + # TODO Remove in master. + if page_name == '_': + continue for snippet_name in configurator_snippets[page_name]: create_values.append(get_create_vals( f"Snippet {snippet_name!r} for {page_name!r} pages generated by the configurator",