[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
This commit is contained in:
Benoit Socias
2023-12-01 18:14:16 +00:00
parent c191a08f03
commit 7fecf17047
@@ -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",