[IMP] mail: turn 'Message/shorttime' into field

Task-2793280

closes odoo/odoo#86459

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Alexandre Kühn
2022-03-18 15:11:41 +01:00
parent 1f7d6213d4
commit 642cec94c4
3 changed files with 14 additions and 10 deletions
@@ -230,15 +230,6 @@ export class Message extends Component {
}
}
/**
* Get the shorttime format of the message date.
*
* @returns {string}
*/
get shortTime() {
return this.messageView.message.date.format('hh:mm');
}
//--------------------------------------------------------------------------
// Private
//--------------------------------------------------------------------------
@@ -46,7 +46,7 @@
<t t-else="">
<t t-if="isActive and messageView.message.date">
<div class="o_Message_date o_Message_sidebarItem mt-1" t-att-class="{ 'o-message-selected': isSelected }">
<t t-esc="shortTime"/>
<t t-esc="messageView.message.shortTime"/>
</div>
</t>
<t t-if="!isActive and messageView.message.isCurrentUserOrGuestAuthor and messageView.threadView and messageView.threadView.thread and messageView.threadView.thread.hasSeenIndicators">
+13
View File
@@ -555,6 +555,16 @@ registerModel({
// add anchor tags to urls
return parseAndTransform(prettyBody, addLink);
},
/**
* @private
* @returns {string|FieldCommand}
*/
_computeShortTime() {
if (!this.date) {
return clear();
}
return this.date.format('hh:mm');
},
/**
* @private
* @returns {Thread[]}
@@ -878,6 +888,9 @@ registerModel({
default: "",
}),
recipients: many('Partner'),
shortTime: attr({
compute: '_computeShortTime',
}),
subject: attr(),
subtype_description: attr(),
subtype_id: attr(),