[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 <rdeodoo@users.noreply.github.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
Younn Olivier
2021-09-03 00:49:13 +00:00
parent 151d570933
commit 65fb31454f
@@ -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', {