[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
This commit is contained in:
Lucas Perais (lpe)
2018-10-15 12:46:16 +00:00
parent 42c6db5e01
commit f2ff47403f
+3 -1
View File
@@ -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'):