diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index eb0a4a2cdaf5d6c98498fc51911b38410acd6a8d..aff339cb4a2415e3dc162b2da500043c4531b746 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 diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index b924afce8d5451b14ea671f1f65833f9e790eb29..909e778b60a873cc35bd9ac8a6718ef66d44e824 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -3042,7 +3042,7 @@ QUnit.module('basic_fields', { QUnit.module('PhoneWidget'); QUnit.test('phone field in form view on extra small screens', function (assert) { - assert.expect(7); + assert.expect(8); var form = createView({ View: FormView, @@ -3090,6 +3090,15 @@ QUnit.module('basic_fields', { assert.strictEqual($phoneLink.attr('href'), 'tel:new', "should still have proper tel prefix"); + // NOT NEEDED AS OF SAAS-11.3 + // save phone with ­ and verify it is removed + form.$buttons.find('.o_form_button_edit').click(); + form.$('input[type="text"].o_field_widget').val('h\u00ADi').trigger('input'); + form.$buttons.find('.o_form_button_save').click(); + $phoneLink = form.$('a.o_form_uri.o_field_widget'); + assert.strictEqual($phoneLink.attr('href'), 'tel:hi', + "U+00AD should have been removed"); + form.destroy(); });