From 4396439f279ebf43ea11f6e653e2198e07bdedc0 Mon Sep 17 00:00:00 2001 From: Benoit Socias Date: Tue, 30 Mar 2021 08:58:24 +0000 Subject: [PATCH] [FIX] website_sale: not use t-if on attribute of snippet section Before this commit the default product category was set on the product snippet by a wrong use of qweb's tag, trying to use t-if to only apply the change for product snippet. This actually was ignored and the attribute was appearing on all dropped dynamic snippets (including blogs). After this commit the default product category is set on the product snippet from javascript. https://github.com/odoo/odoo/pull/68529 --- .../src/snippets/s_dynamic_snippet_products/options.js | 9 ++++++++- .../views/snippets/s_dynamic_snippet_products.xml | 5 ----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/addons/website_sale/static/src/snippets/s_dynamic_snippet_products/options.js b/addons/website_sale/static/src/snippets/s_dynamic_snippet_products/options.js index b604aa17dfe..cfb70be184a 100644 --- a/addons/website_sale/static/src/snippets/s_dynamic_snippet_products/options.js +++ b/addons/website_sale/static/src/snippets/s_dynamic_snippet_products/options.js @@ -63,7 +63,14 @@ const dynamicSnippetProductsOptions = s_dynamic_snippet_carousel_options.extend( const productCategoriesSelectorEl = uiFragment.querySelector('[data-name="product_category_opt"]'); return this._renderSelectUserValueWidgetButtons(productCategoriesSelectorEl, this.productCategories); }, - + /** + * @override + * @private + */ + _setOptionsDefaultValues: function () { + this._setOptionValue('productCategoryId', 'all'); + this._super.apply(this, arguments); + }, }); options.registry.dynamic_snippet_products = dynamicSnippetProductsOptions; diff --git a/addons/website_sale/views/snippets/s_dynamic_snippet_products.xml b/addons/website_sale/views/snippets/s_dynamic_snippet_products.xml index 5eeb8084dc3..8dee7a7f2da 100644 --- a/addons/website_sale/views/snippets/s_dynamic_snippet_products.xml +++ b/addons/website_sale/views/snippets/s_dynamic_snippet_products.xml @@ -5,11 +5,6 @@ -