diff --git a/addons/web/static/src/js/fields/special_fields.js b/addons/web/static/src/js/fields/special_fields.js index 0aac16822d0..7b8e53095e1 100644 --- a/addons/web/static/src/js/fields/special_fields.js +++ b/addons/web/static/src/js/fields/special_fields.js @@ -74,6 +74,7 @@ var FieldTimezoneMismatch = FieldSelection.extend({ this.$el.last().filter('.o_tz_warning').remove(); this.$el = this.$el.first(); var value = this.$el.val(); + var $span = $(''); if (this.$option) { this.$option.html(this.$option.html().split(' ')[0]); @@ -90,15 +91,18 @@ var FieldTimezoneMismatch = FieldSelection.extend({ } if (this.mismatch){ - var $span = $(''); $span.insertAfter(this.$el); - $span.attr('title', _t("Timezone Mismatch : The timezone of your browser doesn't match the selected one. The time in Odoo is displayed according to the timezone set on your user's preferences.")); + $span.attr('title', _t("Timezone Mismatch : This timezone is different from that of your browser.\nPlease, set the same timezone as your browser's to avoid time discrepancies in your system.")); this.$el = this.$el.add($span); this.$option = this.$('option').filter(function () { return $(this).attr('value') === value; }); this._renderDateTimeTimezone(); + } else if (value == "false") { + $span.insertAfter(this.$el); + $span.attr('title', _t("Set a timezone on your user")); + this.$el = this.$el.add($span); } }, /** diff --git a/addons/web/static/src/scss/form_view.scss b/addons/web/static/src/scss/form_view.scss index 7746742b3b1..35c5b6c5d74 100644 --- a/addons/web/static/src/scss/form_view.scss +++ b/addons/web/static/src/scss/form_view.scss @@ -557,7 +557,7 @@ color: theme-color('danger'); cursor: help; position: absolute; - margin-left: -40px; + margin-left: 10px; margin-top: 5px; } diff --git a/addons/web/static/tests/fields/special_fields.js b/addons/web/static/tests/fields/special_fields.js index 2a674be19ba..bfde65abf12 100644 --- a/addons/web/static/tests/fields/special_fields.js +++ b/addons/web/static/tests/fields/special_fields.js @@ -185,7 +185,7 @@ QUnit.module('special_fields', { }); QUnit.test('widget timezone_mismatch in a form view', async function (assert) { - assert.expect(1); + assert.expect(2); this.data.partner.fields.tz_offset = { string: "tz_offset", @@ -210,6 +210,10 @@ QUnit.module('special_fields', { }); await testUtils.form.clickEdit(form); assert.containsOnce(form, 'select[name=tz]'); + + var $timezoneMismatch = form.$('.o_tz_warning'); + assert.strictEqual($timezoneMismatch.length, 1, "warning class should be there."); + form.destroy(); }); diff --git a/odoo/addons/base/models/res_partner.py b/odoo/addons/base/models/res_partner.py index e008cc1c5d2..f9309a53c16 100644 --- a/odoo/addons/base/models/res_partner.py +++ b/odoo/addons/base/models/res_partner.py @@ -155,10 +155,10 @@ class Partner(models.Model): lang = fields.Selection(_lang_get, string='Language', default=lambda self: self.env.lang, help="All the emails and documents sent to this contact will be translated in this language.") tz = fields.Selection(_tz_get, string='Timezone', default=lambda self: self._context.get('tz'), - help="The partner's timezone, used to output proper date and time values " - "inside printed reports. It is important to set a value for this field. " - "You should use the same timezone that is otherwise used to pick and " - "render date and time values: your computer's timezone.") + help="When printing documents and exporting/importing data, time values are computed according to this timezone.\n" + "If the timezone is not set, UTC (Coordinated Universal Time) is used.\n" + "Anywhere else, time values are computed according to the time offset of your web client.") + tz_offset = fields.Char(compute='_compute_tz_offset', string='Timezone offset', invisible=True) user_id = fields.Many2one('res.users', string='Salesperson', help='The internal user in charge of this contact.')