From 69ae6e2912aaf6190d9856f04069d725ef5ad5a4 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 18 Apr 2017 14:24:04 +0200 Subject: [FIX] web: use correct timezone for date fields before this commit when toggling allday flag in calendar form view, it was possible to have one day error. The input datetime is wrong when the user don't use the datepicker widget (insert date by keypress instead of click on datepicker) sometimes, the value could be null (crash because try to clone false) --- addons/web/static/src/js/fields/basic_fields.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'addons/web/static/src/js/fields/basic_fields.js') diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index 9f37240e0cc..85cd0382ac2 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -282,6 +282,14 @@ var FieldDate = InputField.extend({ // Private //-------------------------------------------------------------------------- + /** + * @override + * @private + */ + _doDebouncedAction: function () { + this.datewidget.change_datetime(); + }, + /** * return the datepicker value * @@ -311,6 +319,16 @@ var FieldDate = InputField.extend({ this.$input = this.datewidget.$input; }, + /** + * FieldDateTime overrides _formatValue to use the session timezone + * + * @override + * @private + * @param {Moment} value + */ + _formatValue: function (value) { + return field_utils.format.date(value, {timezone: true}); + }, }); var FieldDateTime = FieldDate.extend({ -- cgit v1.2.3