From 65fb31454f3e2bcf1f833f622878655569847e9d Mon Sep 17 00:00:00 2001 From: Younn Olivier Date: Thu, 2 Sep 2021 08:55:05 +0000 Subject: [PATCH] [FIX] web_editor: skip rollback when cloning a snippet There were two issues when cloning a website_form field: 1/ Cloning is not done Steps to reproduce : Drop a form from the editor, save Click on edit, select the field Click on the clone option without hovering the label position option 2/ A traceback is thrown Drop a form from the editor, save Click on edit, select the field Click on the clone option after hovering the label position option Some FieldEditor options modify directly the dom and replace the field node, which the editor will detect as a change of unbreakables. As a result a rollback will be required in the next call to odooEitor.historyStep(), done in SnippetEditor.clone(). To solve that we skip potential rollbacks while recording a history step during a clone. task-2485093 closes odoo/odoo#75908 X-original-commit: 7a75f295087cb02f162477a9df3b138b6780dbdd Signed-off-by: Romain Derie Signed-off-by: Quentin Smetz (qsm) --- addons/web_editor/static/src/js/editor/snippets.editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js index ca33572d6fd..525bb568eea 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -658,7 +658,7 @@ var SnippetEditor = Widget.extend({ this.$target.after($clone); if (recordUndo) { - this.options.wysiwyg.odooEditor.historyStep(); + this.options.wysiwyg.odooEditor.historyStep(true); } await new Promise(resolve => { this.trigger_up('call_for_each_child_snippet', {