From 6f223edf4f57b44b65f02b4711c362fa0ce44a7d Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Thu, 9 Jun 2016 10:45:01 +0200 Subject: [FIX] mail: display date and datetime in tracking value with the right timzeone. When tracking value is converted to be rendered as a message_post, we convert the date/datetime with the current local from momentjs. Related to #12327 Courtesy of @aab-odoo for help and review. --- addons/mail/static/src/js/thread.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'addons/mail/static/src/js/thread.js') diff --git a/addons/mail/static/src/js/thread.js b/addons/mail/static/src/js/thread.js index ac4c50b4533..f0d5ae05339 100644 --- a/addons/mail/static/src/js/thread.js +++ b/addons/mail/static/src/js/thread.js @@ -151,6 +151,20 @@ var Thread = Widget.extend({ msg.hour = msg.date.format('LT'); } + if (message.tracking_value_ids && message.tracking_value_ids.length) { + _.each(message.tracking_value_ids, function(f) { + if (_.contains(['date', 'datetime'], f.field_type)) { + var format = (f.field_type === 'date') ? 'LL' : '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); + } + } + }); + } + if (_.contains(this.expanded_msg_ids, message.id)) { msg.expanded = true; } -- cgit v1.2.3