From 3e5d16967f62e6239ec87e9b56f997fad3d892cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Geelen=20=28sge=29?= Date: Thu, 23 Feb 2023 15:16:57 +0000 Subject: [PATCH] [FIX] web_editor: strip history ids in isDirty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The presence of the history ids in the html resulted in false positive in the `_isDirty()` comparison. This lead to unwanted writes when switching records, even when no change were made. task-3186072 closes odoo/odoo#113633 X-original-commit: dcd3a538ecd4d7dc35bd7de6a8e2655e7392660a Signed-off-by: David Monjoie (dmo) Signed-off-by: Geelen Sébastien (sge) --- addons/web_editor/static/src/js/backend/html_field.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/backend/html_field.js b/addons/web_editor/static/src/js/backend/html_field.js index 4a15cf30a0f..57aabdac90f 100644 --- a/addons/web_editor/static/src/js/backend/html_field.js +++ b/addons/web_editor/static/src/js/backend/html_field.js @@ -385,7 +385,9 @@ export class HtmlField extends Component { } } _isDirty() { - return !this.props.readonly && this.props.value.toString() !== this.getEditingValue(); + const strippedPropValue = stripHistoryIds(String(this.props.value)); + const strippedEditingValue = stripHistoryIds(this.getEditingValue()); + return !this.props.readonly && strippedPropValue !== strippedEditingValue; } _getCodeViewEl() { return this.state.showCodeView && this.codeViewRef.el;