diff options
| author | Xavier-Do <Xavier-Do@users.noreply.github.com> | 2018-01-19 11:52:10 +0100 |
|---|---|---|
| committer | XavierDo <xdo@odoo.com> | 2018-01-30 14:49:03 +0100 |
| commit | c99de4551583e801ecc6669ac456c4f7e2eef1da (patch) | |
| tree | bcf7a41437147ce9675f9219b2cb2f2ad6d3742b /addons/mail/models/mail_message.py | |
| parent | ba5133dc6329cf373a809f330eea5ef19367c232 (diff) | |
[IMP] chatter: improve chatter readability
Only messages as comments and email template should keep a white backround since they are not internal.
It is also enough to display fields that changed on subtypes (update message) since emails will be reworked soon and more information will be given there. The support of 'always' track can be removed. (is now considered as a simple tracked field)
The use of self.env.ref('mail.mt_comment').id add some query and the performance tests needs to be update since message_format is called by notify_by_chat. This code will be refactor later
Diffstat (limited to 'addons/mail/models/mail_message.py')
| -rw-r--r-- | addons/mail/models/mail_message.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/mail/models/mail_message.py b/addons/mail/models/mail_message.py index 0f3665c4acb..8fa05876f79 100644 --- a/addons/mail/models/mail_message.py +++ b/addons/mail/models/mail_message.py @@ -404,6 +404,7 @@ class Message(models.Model): 'id': 59, 'subject': False 'is_note': True # only if the subtype is internal + 'is_discussion': False # only if the message is a discussion (subtype == discussion) } """ message_values = self.read([ @@ -417,13 +418,15 @@ class Message(models.Model): message_tree = dict((m.id, m) for m in self.sudo()) self._message_read_dict_postprocess(message_values, message_tree) - # add subtype data (is_note flag, subtype_description). Do it as sudo + # add subtype data (is_note flag, is_discussion flag , subtype_description). Do it as sudo # because portal / public may have to look for internal subtypes subtype_ids = [msg['subtype_id'][0] for msg in message_values if msg['subtype_id']] - subtypes = self.env['mail.message.subtype'].sudo().browse(subtype_ids).read(['internal', 'description']) + subtypes = self.env['mail.message.subtype'].sudo().browse(subtype_ids).read(['internal', 'description','id']) subtypes_dict = dict((subtype['id'], subtype) for subtype in subtypes) + xml_comment_id = self.env.ref('mail.mt_comment').id for message in message_values: message['is_note'] = message['subtype_id'] and subtypes_dict[message['subtype_id'][0]]['internal'] + message['is_discussion'] = message['subtype_id'] and subtypes_dict[message['subtype_id'][0]]['id'] == xml_comment_id message['subtype_description'] = message['subtype_id'] and subtypes_dict[message['subtype_id'][0]]['description'] if message['model'] and self.env[message['model']]._original_module: message['module_icon'] = modules.module.get_module_icon(self.env[message['model']]._original_module) |
