[FIX] mail: js change _date to date for display date of message. display complete date if more of 7 days

bzr revid: chm@openerp.com-20130129153528-cffz4dbbn6i80euw
This commit is contained in:
Christophe Matthieu 2013-01-29 16:35:28 +01:00
parent 22c857caf3
commit 79c15f832c
2 changed files with 5 additions and 4 deletions

View File

@ -218,7 +218,7 @@ openerp.mail = function (session) {
this.author_id = datasets.author_id || false,
this.attachment_ids = datasets.attachment_ids || [],
this.partner_ids = datasets.partner_ids || [];
this._date = datasets.date;
this.date = datasets.date;
this.format_data();
@ -243,8 +243,9 @@ openerp.mail = function (session) {
/* Convert date, timerelative and avatar in displayable data. */
format_data: function () {
//formating and add some fields for render
if (this._date) {
this.timerelative = $.timeago(this._date+"Z");
if (this.date && new Date().getTime()-Date.parse(this.date).getTime() < 7*24*60*60*1000) {
debugger;
this.timerelative = $.timeago(this.date+"Z");
}
if (this.type == 'email' && (!this.author_id || !this.author_id[0])) {
this.avatar = ('/mail/static/src/img/email_icon.png');

View File

@ -246,7 +246,7 @@
<a t-if="widget.author_id and widget.options.show_link and widget.author_id[0]" t-attf-href="#model=res.partner&amp;id=#{widget.author_id[0]}"><t t-raw="widget.author_id[2]"/></a>
<span t-if="widget.author_id and (!widget.options.show_link or !widget.author_id[0])"><t t-raw="widget.author_id[2]"/></span>
<span class='oe_subtle'></span>
<span t-att-title="widget.date"><t t-raw="widget.timerelative"/></span>
<span t-att-title="widget.date"><t t-if="widget.timerelative" t-raw="widget.timerelative"/><t t-if="!widget.timerelative" t-raw="widget.date"/></span>
<span t-if="!widget.options.readonly" class='oe_subtle'></span>
<t t-if="!widget.options.readonly" t-call="mail.thread.message.vote"/>
</div>