[FIX] web_editor: missing use of applyTo param for visibility update

Part of https://github.com/odoo/odoo/pull/42136
This commit is contained in:
qsm-odoo
2019-12-19 10:06:54 +00:00
parent d08023f06a
commit 2ebe088def
@@ -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;