From 469a2ebc3849d23db1b63ced0b5d18188b002d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Geelen=20=28sge=29?= Date: Thu, 18 Nov 2021 14:40:02 +0000 Subject: [PATCH] [FIX] web_editor: ZWS in monetary fields Value changed in monetary fields were not saved correctly. Zero Width Spaces in the monetary field new value caused the model to reject the value as the format (numerical) was not compliant. task-2679088 X-original-commit: a776e55c6fb03861eed9668fad259c0a92b9aff8 Part-of: odoo/odoo#80071 --- addons/web_editor/static/src/js/wysiwyg/wysiwyg.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index bc69853252b..9f6532eda21 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -1863,12 +1863,17 @@ const Wysiwyg = Widget.extend({ return Promise.resolve(); } + // remove ZeroWidthSpace from odoo field value + // ZeroWidthSpace may be present from OdooEditor edition process + let escapedHtml = this._getEscapedElement($el).prop('outerHTML'); + escapedHtml = escapedHtml.replace(/[\u200B-\u200D\uFEFF]/g, ''); + return this._rpc({ model: 'ir.ui.view', method: 'save', args: [ viewID, - this._getEscapedElement($el).prop('outerHTML'), + escapedHtml, !$el.data('oe-expression') && $el.data('oe-xpath') || null, // Note: hacky way to get the oe-xpath only if not a t-field ], context: context,