[REM] mail: remove 'message_last_post' mechanism

Thread mixin class adds a message_last_post field. This field may be
updated when a comment is posted, depending on a context key. Since a
while this context key is not used anymore. This means the field is never
updated. As it is used only as a filter in project we decided to remove
it.

This commit remove the field and the context key support. This kind of
specific feature can be done using customization if necessary in some
advanced use case.
This commit is contained in:
Thibault Delavallée
2018-01-08 15:03:31 +01:00
parent 2303dcb2a9
commit 4622059b4d
2 changed files with 1 additions and 14 deletions
+1 -12
View File
@@ -66,8 +66,6 @@ class MailThread(models.AbstractModel):
creating messages
- ``tracking_disable``: at create and write, perform no MailThread features
(auto subscription, tracking, post, ...)
- ``mail_save_message_last_post``: at message_post, update message_last_post
datetime field
- ``mail_auto_delete``: auto delete mail notifications; True by default
(technical hack for templates)
- ``mail_notify_force_send``: if less than 50 email notifications to send,
@@ -95,7 +93,6 @@ class MailThread(models.AbstractModel):
message_ids = fields.One2many(
'mail.message', 'res_id', string='Messages',
domain=lambda self: [('model', '=', self._name)], auto_join=True)
message_last_post = fields.Datetime('Last Message Date', help='Date of the last message posted on the record.')
message_unread = fields.Boolean(
'Unread Messages', compute='_get_message_unread',
help="If checked new messages require your attention.")
@@ -1907,15 +1904,7 @@ class MailThread(models.AbstractModel):
# Post the message
new_message = MailMessage.create(values)
# Post-process: subscribe author, update message_last_post
# Note: the message_last_post mechanism is no longer used. This
# will be removed in a later version.
if (self._context.get('mail_save_message_last_post') and
model and model != 'mail.thread' and self.ids and subtype_id):
subtype_rec = self.env['mail.message.subtype'].sudo().browse(subtype_id)
if not subtype_rec.internal:
# done with SUPERUSER_ID, because on some models users can post only with read access, not necessarily write access
self.sudo().write({'message_last_post': fields.Datetime.now()})
# Post-process: subscribe author
if author_id and model and self.ids and message_type != 'notification' and not self._context.get('mail_create_nosubscribe'):
self.message_subscribe([author_id], force=False)
-2
View File
@@ -55,8 +55,6 @@
<filter string="Assigned to" name="user" context="{'group_by':'user_id'}"/>
<filter string="Stage" name="stage" context="{'group_by':'stage_id'}"/>
<filter string="Company" name="company" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator/>
<filter string="Last Message" name="group_message_last_post" context="{'group_by':'message_last_post:week'}"/>
</group>
</search>
</field>