diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-04-17 16:24:27 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-04-17 16:24:27 +0200 |
| commit | 0cd2cff2596021400c4f082ca14501c6aa859652 (patch) | |
| tree | 8bc061d080ce8a252bada9a2261d5972736a4155 /addons/web/static/tests/fields/basic_fields_tests.js | |
| parent | 1328c0960d5e561819f79a04483ff5b88e77df69 (diff) | |
| parent | fdef30fc2995d182fe779a777fb42ba1066c2cac (diff) | |
[MERGE] forward port branch saas-11.3 up to fdef30fc299
Diffstat (limited to 'addons/web/static/tests/fields/basic_fields_tests.js')
| -rw-r--r-- | addons/web/static/tests/fields/basic_fields_tests.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index 7a2999e18b3..6aa28fd9a2e 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -2365,6 +2365,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:'<form string="Partners"><field name="datetime"/></form>', + 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); |
