From a64e76e90a44448b44703439c8fe17b89baa0bf2 Mon Sep 17 00:00:00 2001 From: Benoit Socias Date: Tue, 30 Mar 2021 09:32:11 +0000 Subject: [PATCH] [FIX] website: disable preview on dynamic snippet filter selection Before this commit filter selection on the dynamic snippet did trigger the rendering of a preview. This sometimes caused a blocking loader to appear when the filter selection triggered the replacement of the list of available templates. After this commit selecting a filter does not trigger a preview rendering anymore. Also the condition for making the warning message appear is now about the selected template being in the list of available templates. https://github.com/odoo/odoo/pull/68529 --- .../website/static/src/snippets/s_dynamic_snippet/options.js | 4 ++-- addons/website/views/snippets/s_dynamic_snippet.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/website/static/src/snippets/s_dynamic_snippet/options.js b/addons/website/static/src/snippets/s_dynamic_snippet/options.js index 4777d27729a..7d76ee8509b 100644 --- a/addons/website/static/src/snippets/s_dynamic_snippet/options.js +++ b/addons/website/static/src/snippets/s_dynamic_snippet/options.js @@ -74,10 +74,10 @@ const dynamicSnippetOptions = options.Class.extend({ */ _refreshPublicWidgets: function () { return this._super.apply(this, arguments).then(() => { - const templateKeys = this.$el ? this.$el.find("we-select[data-attribute-name='templateKey'] we-selection-items we-button") : []; + const selectedTemplateId = this.$target.get(0).dataset['templateKey']; this.$target.find('.missing_option_warning').toggleClass( 'd-none', - templateKeys.length > 0 + !!this.dynamicFilterTemplates[selectedTemplateId] ); }); }, diff --git a/addons/website/views/snippets/s_dynamic_snippet.xml b/addons/website/views/snippets/s_dynamic_snippet.xml index a165f2c1eea..61d65a8f835 100644 --- a/addons/website/views/snippets/s_dynamic_snippet.xml +++ b/addons/website/views/snippets/s_dynamic_snippet.xml @@ -19,7 +19,7 @@