Skip to content

Commit 0fddcfa

Browse files
author
Ivan Yelizariev
committed
[FIX] theme-like dependecies of the theme have be handled as theme
1 parent 14d60ab commit 0fddcfa

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

website_multi_theme/models/website_theme.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,30 @@ class WebsiteTheme(models.Model):
3232
"in websites that enable this theme in multiwebsite mode.",
3333
)
3434

35+
dependency_ids = fields.Many2many(
36+
'ir.module.module',
37+
string="Dependencies",
38+
help='Theme-like dependencies. Add modules here if you got error "The style compilation failed".')
39+
3540
def _convert_assets(self):
3641
"""Generate assets for converted themes"""
3742
Asset = self.env["website.theme.asset"]
3843
for one in self.filtered("converted_theme_addon"):
3944
# Get all views owned by the converted theme addon
4045
refs = self.env["ir.model.data"].search([
41-
("module", "=", one.converted_theme_addon),
46+
("module", "in", [one.converted_theme_addon] + one.dependency_ids.mapped('name')),
4247
("model", "=", "ir.ui.view"),
4348
])
4449
existing = frozenset(one.mapped("asset_ids.name"))
4550
expected = frozenset(refs.mapped("complete_name"))
4651
dangling = tuple(existing - expected)
4752
# Create a new asset for each theme view
4853
for ref in expected - existing:
54+
view = self.env.ref(ref, raise_if_not_found=False)
55+
if view and view.type != 'qweb':
56+
# skip backend views
57+
continue
58+
4959
_logger.debug("Creating asset %s for theme %s", ref, one.name)
5060
one.asset_ids |= Asset.new({
5161
"name": ref,

0 commit comments

Comments
 (0)