From bc34fe481d0c65f6c9e5cb5e12268586515f7795 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Tue, 10 May 2016 15:37:21 +0200 Subject: [PATCH] [FIX] mail: don't reset subscriptions before adding one When posting on a thread the user can be auto-subscribed to its default types. But if the user has previously been subscribed to other subtypes, those are lost. With this commit, user mentionned (@{username} in message) or added as follower for default subtypes are not subscribed if they were already followers of the record. So if default subtype is "Comment" and user was only following subtype "Alarma!" (by checking it and then un-checking "Comment"), then if the user comment: -> before this commit, the user would then follow subtype "Comment" and not follow anymore "Alarma!" -> after this commit, the user would follow the subtype "Alarma!" closes #12008 opw-669127 opw-673766 --- addons/mail/models/mail_thread.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index feea6292e8f..7f30862be5f 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -1691,7 +1691,7 @@ class MailThread(models.AbstractModel): partner_to_subscribe = partner_ids if self._context.get('mail_post_autofollow_partner_ids'): partner_to_subscribe = filter(lambda item: item in self._context.get('mail_post_autofollow_partner_ids'), partner_ids) - self.message_subscribe(list(partner_to_subscribe)) + self.message_subscribe(list(partner_to_subscribe), force=False) # _mail_flat_thread: automatically set free messages to the first posted message MailMessage = self.env['mail.message'] @@ -1743,7 +1743,7 @@ class MailThread(models.AbstractModel): # 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()}) if new_message.author_id and model and self.ids and message_type != 'notification' and not self._context.get('mail_create_nosubscribe'): - self.message_subscribe([new_message.author_id.id]) + self.message_subscribe([new_message.author_id.id], force=False) return new_message @api.multi