[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) <dmo@odoo.com>
This commit is contained in:
Nicolas Bayet
2022-01-26 13:11:17 +00:00
parent 013f0da147
commit 595cfa7ca2
@@ -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');
}
},
});