diff options
| author | Romain Derie <rde@odoo.com> | 2019-02-20 14:31:02 +0000 |
|---|---|---|
| committer | Romain Derie <rde@odoo.com> | 2019-02-20 14:31:02 +0000 |
| commit | edce2fd6d09faee495c6278391f81c6fdf1e3be9 (patch) | |
| tree | 0d2cb2ab1f465d461c0ca4fc5c5c925012af5c74 /addons/web_editor/models/ir_ui_view.py | |
| parent | f6540c26ff5721224ff9001ec338e5c031721ad3 (diff) | |
[FIX] website: keep only specific views on _views_get recursive calls
Before this commit:
If a view A was doing a t-call on a view B and view B had view C as child.
And view A had view D as child.
And view D also t-call view B (that as mentionned above has view C as child).
And view D was inactive.
Then COWing C to set it as inactive would make `get_related_views()` on A to
return both generic active C and COW inactive C.
This rare case appeared for customize option that were enabled by default, like
wishlist, compare..
Disabling this customize option would show both the generic customize view and
the COW customize view.
Resulting in the customize toggle being shown twice, one enabled and one
disabled.
Detailed explanation:
1. `website_sale.products` would call `_views_get()` with `options=True` for its
t-call node `website_sale.products_item`, returning the full view tree,
including COW wishlist.
2. `website_sale.products` would then call `_views_get()` on its child views
with `options=extension.active`.
It is the case for `website_sale.products_list_view`, which also has a
t-call node `website_sale.products_item`.
It would then perform the same `views_get()` as in step 1. but with
`options` set to the view active state, in this case False.
At that point, the `_view_get_inherited_children` method would filter by
active before filter_duplicate, leaving the generic view over the specific
one as it should.
closes odoo/odoo#31286
Diffstat (limited to 'addons/web_editor/models/ir_ui_view.py')
| -rw-r--r-- | addons/web_editor/models/ir_ui_view.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/addons/web_editor/models/ir_ui_view.py b/addons/web_editor/models/ir_ui_view.py index 24bb9884d1f..b870a57edf9 100644 --- a/addons/web_editor/models/ir_ui_view.py +++ b/addons/web_editor/models/ir_ui_view.py @@ -205,11 +205,7 @@ class IrUiView(models.Model): @api.model def _view_get_inherited_children(self, view, options): - extensions = view.inherit_children_ids - if not options: - # only active children - extensions = extensions.filtered(lambda view: view.active) - return extensions + return view.inherit_children_ids @api.model def _view_obj(self, view_id): @@ -257,6 +253,9 @@ class IrUiView(models.Model): views_to_return += self._views_get(called_view, options=options, bundles=bundles) extensions = self._view_get_inherited_children(view, options) + if not options: + # only active children + extensions = extensions.filtered(lambda view: view.active) # Keep options in a deterministic order regardless of their applicability for extension in extensions.sorted(key=lambda v: v.id): |
