From a03fc2d849260b11dbde9fc51bfcc8ece7eaa6bc Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 15 Jun 2017 11:38:25 -0300 Subject: [PATCH] [FIX] mail: track date change - Set your timezone in Brasil - Install the Maintenance module - Create a Maintenance Request, set the Requested Date to 2017-06-15 - Save In the chatter, the track fields message shows a Requested Date of 2017-06-14. This can actually happen with any date tracked. The issue comes from the web client: it converts the date in UTC, which should of course not be done. This only applies for a datetime, not for a date. opw-746216 --- addons/mail/static/src/js/chat_manager.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/addons/mail/static/src/js/chat_manager.js b/addons/mail/static/src/js/chat_manager.js index f22457e2cb0..56632a918b7 100644 --- a/addons/mail/static/src/js/chat_manager.js +++ b/addons/mail/static/src/js/chat_manager.js @@ -287,14 +287,22 @@ function make_message (data) { // can not be done in preprocess, since it alter the original value if (msg.tracking_value_ids && msg.tracking_value_ids.length) { _.each(msg.tracking_value_ids, function(f) { - if (_.contains(['date', 'datetime'], f.field_type)) { - var format = (f.field_type === 'date') ? 'LL' : 'LLL'; + if (f.field_type === 'datetime') { + var format = 'LLL'; if (f.old_value) { f.old_value = moment.utc(f.old_value).local().format(format); } if (f.new_value) { f.new_value = moment.utc(f.new_value).local().format(format); } + } else if (f.field_type === 'date') { + var format = 'LL'; + if (f.old_value) { + f.old_value = moment(f.old_value).local().format(format); + } + if (f.new_value) { + f.new_value = moment(f.new_value).local().format(format); + } } }); }