From b8b0f947bf7f7abf930a1797fa55c7f7dd33faa2 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Fri, 13 Apr 2018 14:30:46 +0200 Subject: [FIX] web: remove ­ when saving phone number When Odoo display a phone number number, on phone or if VOIP is installed a invisible `­` character was added from 9.0 up to saas-11.2 so an applications such as skype would not be concerned with the number. But if someone copy-pasted from this to somewhere else in Odoo, we would get incorrect number with this invisible caracter. So this change make a special case for the "FieldPhone" so the character is removed from data saved. opw-1834858 closes #24223 --- addons/web/static/src/js/fields/basic_fields.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'addons/web/static/src/js/fields/basic_fields.js') diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index eb0a4a2cdaf..aff339cb4a2 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -1013,6 +1013,21 @@ var FieldPhone = FieldEmail.extend({ this.$el.removeClass('o_text_overflow'); }, + /** + * Remove possibly present ­ characters when saving number + * + * @override + * @private + */ + _setValue: function (value, options) { + // NOT NEEDED AS OF SAAS-11.3 + if (value) { + // remove possibly pasted ­ characters + value = value.replace(/\u00AD/g, ''); + } + return this._super(value, options); + }, + /** * Phone fields are clickable in readonly on small screens ~= on phones. * This can be overriden by call-capable modules to display a clickable -- cgit v1.2.3