[FIX] website_sale: fix traceback when unselecting attribute

This commit fixes a traceback when changing the attributes when the
current page has no products to display

TaskId-3045085

closes odoo/odoo#105515

X-original-commit: b8a1b1143eec4a85b9dc8b2c6fbb0112f6b813d7
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
This commit is contained in:
William Braeckman
2022-11-09 22:12:48 +01:00
parent 9b08bb0ea8
commit a901105299
@@ -737,7 +737,10 @@ publicWidget.registry.WebsiteSale = publicWidget.Widget.extend(VariantMixin, car
_onChangeAttribute: function (ev) {
if (!ev.isDefaultPrevented()) {
ev.preventDefault();
this.el.querySelector('.o_wsale_products_grid_table_wrapper').classList.add('opacity-50');
const productGrid = this.el.querySelector(".o_wsale_products_grid_table_wrapper");
if (productGrid) {
productGrid.classList.add("opacity-50");
}
$(ev.currentTarget).closest("form").submit();
}
},