diff --git a/addons/mail/static/src/js/chat_manager.js b/addons/mail/static/src/js/chat_manager.js index 78f5547e6c8..02c4ce89852 100644 --- a/addons/mail/static/src/js/chat_manager.js +++ b/addons/mail/static/src/js/chat_manager.js @@ -282,6 +282,22 @@ function make_message (data) { a.url = '/web/content/' + a.id + '?download=true'; }); + // format date to the local only once by message + // 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.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); + } + } + }); + } + return msg; } diff --git a/addons/mail/static/src/js/thread.js b/addons/mail/static/src/js/thread.js index f0d5ae05339..ac4c50b4533 100644 --- a/addons/mail/static/src/js/thread.js +++ b/addons/mail/static/src/js/thread.js @@ -151,20 +151,6 @@ 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; }