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