From 2ebe088def2cba6b89da325f8a3852afe1afb0a2 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Wed, 18 Dec 2019 16:44:15 +0000 Subject: [PATCH] [FIX] web_editor: missing use of applyTo param for visibility update Part of https://github.com/odoo/odoo/pull/42136 --- .../static/src/js/editor/snippets.options.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js index 4a465ffe3df..435e6f8beb1 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -1565,7 +1565,18 @@ const SnippetOptionWidget = Widget.extend({ updateUIVisibility: async function () { const proms = this._userValueWidgets.map(async widget => { const params = widget.getMethodsParams(); - const show = await this._computeWidgetVisibility(widget.getName(), params); + + let obj = this; + if (params.applyTo) { + const $firstSubTarget = this.$(params.applyTo).eq(0); + if (!$firstSubTarget.length) { + widget.toggleVisibility(false); + return; + } + obj = createPropertyProxy(this, '$target', $firstSubTarget); + } + + const show = await this._computeWidgetVisibility.call(obj, widget.getName(), params); if (!show) { widget.toggleVisibility(false); return;