[FIX] mail: thread: messages' date displayed in browser's timezone

This commit is contained in:
Aaron Bohy
2015-10-06 16:23:56 +02:00
parent 581c38cdca
commit 212bbf1f7e
2 changed files with 7 additions and 3 deletions
+4
View File
@@ -2,6 +2,7 @@ odoo.define('mail.ChatThread', function (require) {
"use strict";
var core = require('web.core');
var time = require('web.time');
var Widget = require('web.Widget');
var QWeb = core.qweb;
@@ -65,6 +66,9 @@ var Thread = Widget.extend({
_preprocess_message: function (message) {
var msg = _.extend({}, message);
// Set the date in the browser timezone
msg.date = moment(time.str_to_datetime(msg.date)).format('YYYY-MM-DD HH:mm:ss');
// Compute displayed author
if (!msg.author_id || !msg.author_id[1]) {
msg.displayed_author = msg.email_from || this.options.default_username;
+3 -3
View File
@@ -21,7 +21,7 @@
<t t-foreach="messages" t-as="message">
<div t-if="current_day != message.date.split(' ')[0]" class="o_thread_date_separator">
<span class="o_thread_date">
<t t-raw="moment(message.date, 'YYYY-MM-DD hh:mm:ss').format('LL')"/>
<t t-esc="moment(message.date, 'YYYY-MM-DD hh:mm:ss').format('LL')"/>
</span>
<t t-set="current_day" t-value="message.date.split(' ')[0]"/>
</div>
@@ -52,7 +52,7 @@
</t>
<small t-att-title="moment(message.date, 'YYYY-MM-DD hh:mm:ss').format('LLL')">
- <t t-esc="moment(message.date, 'YYYY-MM-DD hh:mm:ss').format('hh:mm')"/>
- <t t-esc="moment(message.date, 'YYYY-MM-DD hh:mm:ss').format('hh:mm A')"/>
</small>
<t t-if="message.model &amp;&amp; (message.model != 'mail.channel') &amp;&amp; options.display_document_link">
on <a class="o_mail_redirect" href="#" t-att-data-oe-model="message.model" t-att-data-oe-id="message.res_id"><t t-esc="message.record_name"/></a>
@@ -100,7 +100,7 @@
<t t-name="mail.Attachment">
<div t-attf-class="o_attachment #{attachment.upload ? 'o_attachment_uploading' : ''}" t-att-title="attachment.name">
<a class="o_image" t-att-href='attachment.url' target="_blank" t-att-data-mimetype="attachment.mimetype" t-attf-data-src="/web/image/#{attachment.id}/100x80">
<span class='o_attachment_name'><t t-raw='attachment.name'/></span>
<span class='o_attachment_name'><t t-esc='attachment.name'/></span>
</a>
<t t-if="editable">
<div class="o_attachment_delete">