[FIX] web_editor: strip history ids in isDirty

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) <dmo@odoo.com>
Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
This commit is contained in:
Sébastien Geelen (sge)
2023-02-24 14:20:41 +01:00
committed by David Monjoie
parent 6938ff40d0
commit 3e5d16967f
@@ -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;