[FIX] mail: chatter: subtype when tracking
When having a tracking, the subtype description should be displayed. This is used for tracking linked to a subtype like Task Opened, Task Blocked, ... This feature was forgotten when refactoring the chatter for v9 and is now back.
This commit is contained in:
@@ -549,14 +549,15 @@ class Message(models.Model):
|
||||
message_tree = dict((m.id, m) for m in self)
|
||||
self._message_read_dict_postprocess(message_values, message_tree)
|
||||
|
||||
# add is_note flag
|
||||
internal_subtype_ids = self.env['mail.message.subtype'].search([('internal', '=', True)]).ids
|
||||
# add subtype data (is_note flag, subtype_description)
|
||||
subtypes = self.env['mail.message.subtype'].search(
|
||||
[('id', 'in', [msg['subtype_id'][0] for msg in message_values if msg['subtype_id']])]).read(['internal', 'description'])
|
||||
subtypes_dict = dict((subtype['id'], subtype) for subtype in subtypes)
|
||||
for message in message_values:
|
||||
if message['subtype_id'] and message['subtype_id'][0]:
|
||||
message['is_note'] = bool(message['subtype_id'][0] in internal_subtype_ids)
|
||||
message['is_note'] = message['subtype_id'] and subtypes_dict[message['subtype_id'][0]]['internal']
|
||||
message['subtype_description'] = message['subtype_id'] and subtypes_dict[message['subtype_id'][0]]['description']
|
||||
return message_values
|
||||
|
||||
|
||||
#------------------------------------------------------
|
||||
# mail_message internals
|
||||
#------------------------------------------------------
|
||||
|
||||
@@ -72,6 +72,7 @@ function make_message (data) {
|
||||
body: data.body || "",
|
||||
date: data.date,
|
||||
message_type: data.message_type,
|
||||
subtype_description: data.subtype_description,
|
||||
is_note: data.is_note,
|
||||
attachment_ids: data.attachment_ids,
|
||||
subject: data.subject,
|
||||
|
||||
@@ -102,6 +102,9 @@
|
||||
</span>
|
||||
</p>
|
||||
<t t-if="message.tracking_value_ids && message.tracking_value_ids.length > 0">
|
||||
<t t-if="message.subtype_description">
|
||||
<p t-esc="message.subtype_description"/>
|
||||
</t>
|
||||
<t t-call="mail.ChatThread.MessageTracking"/>
|
||||
</t>
|
||||
<p t-if="message.subject" class="o_mail_subject">Subject: <t t-esc="message.subject"/></p>
|
||||
|
||||
Reference in New Issue
Block a user