From 8d57f21d7df2033f462ead60fcb5abba4546213e Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Mon, 13 Jul 2020 10:16:31 +0000 Subject: [PATCH] [IMP] web_editor: hide we-row with no visible widgets Part of https://github.com/odoo/odoo/pull/53930 task-2157252 --- .../web_editor/static/src/js/editor/snippets.options.js | 9 ++++++++- 1 file changed, 8 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 86165217120..81863acf470 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -1951,7 +1951,14 @@ const SnippetOptionWidget = Widget.extend({ const showUI = await this._computeVisibility(); this.el.classList.toggle('d-none', !showUI); - return Promise.all(proms); + await Promise.all(proms); + + // Hide rows which contains only hidden widgets + for (const rowEl of this.$el.find('we-row')) { + // TODO improve this, this is hackish to rely on DOM structure + // here. Rows should be handled as widgets or something like that. + rowEl.classList.toggle('d-none', $(rowEl).find('> div > .o_we_user_value_widget:not(.d-none)').length === 0); + } }, //--------------------------------------------------------------------------