summaryrefslogtreecommitdiff
path: root/addons/website_theme_install/models/theme_models.py
diff options
context:
space:
mode:
authorfw-bot <otis@odoo.com>2019-10-01 22:46:39 +0000
committerqsm-odoo <qsm@odoo.com>2019-10-02 01:02:56 +0000
commitb77d8a0974962e36c437b339b1bb6aa14b3dd4a6 (patch)
tree34dc1d5da1b83d0f192694c6e7becc8648b06198 /addons/website_theme_install/models/theme_models.py
parenteded0294ab1c5dfc6eb268f84d53ada9ba775352 (diff)
[FIX] website_theme_install: properly attach new views to specific views
When a theme declares a view (a 'theme.ir.ui.view') with an inherit_id, on installation, a view (a 'ir.ui.view') will be created with the corresponding inherit_id. The problem is that this inherit_id may reference a view that has been cow'ed at some point and thus the new theme view will be attached to the non specific view by mistake. Part of https://github.com/odoo/odoo/pull/37142 closes odoo/odoo#37750 X-original-commit: https://github.com/odoo/odoo/commit/f30b4dfdb90515bc54e691302f894184c9b1c55b Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com> Co-authored-by: Romain Derie <rde@odoo.com>
Diffstat (limited to 'addons/website_theme_install/models/theme_models.py')
-rw-r--r--addons/website_theme_install/models/theme_models.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/addons/website_theme_install/models/theme_models.py b/addons/website_theme_install/models/theme_models.py
index 965ead35d00..0c5da7e03f3 100644
--- a/addons/website_theme_install/models/theme_models.py
+++ b/addons/website_theme_install/models/theme_models.py
@@ -40,6 +40,14 @@ class ThemeView(models.Model):
# inherit_id not yet created, add to the queue
return False
+ if inherit and inherit.website_id != website:
+ website_specific_inherit = self.env['ir.ui.view'].with_context(active_test=False).search([
+ ('key', '=', inherit.key),
+ ('website_id', '=', website.id)
+ ], limit=1)
+ if website_specific_inherit:
+ inherit = website_specific_inherit
+
new_view = {
'type': self.type or 'qweb',
'name': self.name,