From f2ff47403fc061aec7d6f77898962859b05e75de Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Mon, 15 Oct 2018 12:36:23 +0000 Subject: [PATCH] [FIX] website: multiwebsite supports optional 'subviews' on the webiste sale, have a category with a subcategory Then in the customize menu, enable "ecommerce categories" Before this commit, the option to have collapsible categories wasn't there This was because, due to multi_website, the children views of the "categories" that were inactive weren't written upon when copying their parent After this commit, the functionality is back OPW 1893169 closes odoo/odoo#27796 --- addons/website/models/ir_ui_view.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/website/models/ir_ui_view.py b/addons/website/models/ir_ui_view.py index 4dc695b8a27..def80932fad 100644 --- a/addons/website/models/ir_ui_view.py +++ b/addons/website/models/ir_ui_view.py @@ -38,7 +38,9 @@ class View(models.Model): ''' current_website_id = self._context.get('website_id') if current_website_id: - for view in self: + # Optional views are inactive but we need to write them + # if their parent is copied + for view in self.with_context(active_test=False): if not view.key and not vals.get('key'): view.with_context(no_cow=True).key = 'website.key_%s' % str(uuid.uuid4())[:6] if not view.website_id and current_website_id and not self._context.get('no_cow'):