From 1039abfbdb1dcfd51e753874795721fc0d617485 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 28 Mar 2018 13:53:39 +0200 Subject: [FIX] web: time format without seconds Steps to reproduce the issue in 11.0 Enterprise: - Go to the language English - Remove from the time format the seconds - Refresh the page - Go to sales - Create a sales order; Bug: - You get the warning message closes #23596 closes #22027 opw:1829577 --- .../web/static/tests/fields/basic_fields_tests.js | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'addons/web/static/tests/fields/basic_fields_tests.js') diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index 4958e2ba42a..b924afce8d5 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -2262,6 +2262,38 @@ QUnit.module('basic_fields', { form.destroy(); }); + QUnit.test('datetime field in form view', function (assert) { + assert.expect(1); + + this.data.partner.fields.datetime.default = "2017-08-02 12:00:05"; + this.data.partner.fields.datetime.required = true; + + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch:'
', + res_id: 1, + translateParameters: { // Avoid issues due to localization formats + date_format: '%m/%d/%Y', + time_format: '%H:%M', + }, + }); + testUtils.patch(basicFields.FieldDate, { + _setValue: function () { + throw "The time format of the language must be taken into account." + return this._super.apply(this, arguments); + }, + }); + form.$buttons.find('.o_form_button_create').click(); + var expectedDateString = "08/02/2017 12:00"; // 10:00:00 without timezone + assert.strictEqual(form.$('.o_field_date input').val(), expectedDateString, + 'the datetime should be correctly displayed in readonly'); + + testUtils.unpatch(basicFields.FieldDate); + form.destroy(); + }); + QUnit.test('datetime field in editable list view', function (assert) { assert.expect(8); -- cgit v1.2.3 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/tests/fields/basic_fields_tests.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'addons/web/static/tests/fields/basic_fields_tests.js') diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index b924afce8d5..909e778b60a 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(); }); -- cgit v1.2.3