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_thread.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_thread.py')
| -rw-r--r-- | addons/mail/models/mail_thread.py | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index dd2c40965f0..9a2f815fe71 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -461,8 +461,7 @@ class MailThread(models.AbstractModel): def _get_tracked_fields(self, updated_fields): """ Return a structure of tracked fields for the current model. :param list updated_fields: modified field names - :return dict: a dict mapping field name to description, containing - always tracked fields and modified on_change fields + :return dict: a dict mapping field name to description, containing on_change fields """ tracked_fields = [] for name, field in self._fields.items(): @@ -521,14 +520,11 @@ class MailThread(models.AbstractModel): - a set of updated column names - a list of changes (initial value, new value, column name, column info) """ self.ensure_one() - changes = set() # contains always and onchange tracked fields that changed - displays = set() # contains always tracked field that did not change but displayed for information + changes = set() # contains onchange tracked fields that changed tracking_value_ids = [] - display_values_ids = [] # generate tracked_values data structure: {'col_name': {col_info, new_value, old_value}} for col_name, col_info in tracked_fields.items(): - track_visibility = getattr(self._fields[col_name], 'track_visibility', 'onchange') initial_value = initial[col_name] new_value = getattr(self, col_name) @@ -539,15 +535,6 @@ class MailThread(models.AbstractModel): if col_name in tracked_fields: changes.add(col_name) - # 'always' tracked fields in separate variable; added if other changes - elif new_value == initial_value and track_visibility == 'always' and col_name in tracked_fields: - tracking = self.env['mail.tracking.value'].create_tracking_values(initial_value, initial_value, col_name, col_info) - if tracking: - display_values_ids.append([0, 0, tracking]) - displays.add(col_name) - - if changes and displays: - tracking_value_ids = display_values_ids + tracking_value_ids return changes, tracking_value_ids |
