summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2017-06-15 11:38:25 -0300
committerNicolas Martinelli <nim@odoo.com>2017-06-21 20:57:16 +0200
commita03fc2d849260b11dbde9fc51bfcc8ece7eaa6bc (patch)
tree0b0305a7e443247ee17204d32d5dee635cc84ad0
parent26627391870af2edd8315748929122392a9a5f68 (diff)
[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
-rw-r--r--addons/mail/static/src/js/chat_manager.js12
1 files 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);
+ }
}
});
}