From 595cfa7ca2adb38a891701422d2cbfa4ce3850fe Mon Sep 17 00:00:00 2001 From: Nicolas Bayet Date: Tue, 11 Jan 2022 08:46:36 +0000 Subject: [PATCH] [FIX] website_sale: prevent editor to make dirty elements Whenever the layout of the shop when editing the /shop page, all the elements mutated from _onApplyShopLayoutChange became dirty but shouldn't have as there is no intention to save those mutations. Task-2676809 closes odoo/odoo#83398 X-original-commit: aca32bc0ab670221ea885cf8c17e7449255f1458 Signed-off-by: David Monjoie (dmo) --- addons/website_sale/static/src/js/website_sale.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/website_sale/static/src/js/website_sale.js b/addons/website_sale/static/src/js/website_sale.js index 720b7a06198..c2cb2d2ef63 100644 --- a/addons/website_sale/static/src/js/website_sale.js +++ b/addons/website_sale/static/src/js/website_sale.js @@ -779,6 +779,10 @@ publicWidget.registry.WebsiteSaleLayout = publicWidget.Widget.extend({ * @param {Event} ev */ _onApplyShopLayoutChange: function (ev) { + const wysiwyg = this.options.wysiwyg; + if (wysiwyg) { + wysiwyg.odooEditor.observerUnactive('_onApplyShopLayoutChange'); + } var switchToList = $(ev.currentTarget).find('.o_wsale_apply_list input').is(':checked'); if (!this.editableMode) { this._rpc({ @@ -797,6 +801,9 @@ publicWidget.registry.WebsiteSaleLayout = publicWidget.Widget.extend({ $grid.toggleClass('o_wsale_layout_list', switchToList); void $grid[0].offsetWidth; $grid.find('*').css('transition', ''); + if (wysiwyg) { + wysiwyg.odooEditor.observerActive('_onApplyShopLayoutChange'); + } }, });