From 0b7990cbce29324b3a804f2cafea9a3f0068fa15 Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Mon, 8 Feb 2016 13:10:29 +0100 Subject: [PATCH] [FIX] mail: put only employees into the group_data 'user' Before, every user was set into this group. It means that a portal user received elements in his mail context, like the buttons to open a document or to follow it. Now, only the employees will receive this kind of information --- addons/mail/models/mail_thread.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index aefbe1a16ff..ad0b2bef16a 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -580,13 +580,14 @@ class MailThread(models.AbstractModel): Example: having defined a group_hr_user entry, store HR users and officers. """ # TDE note: recipients is normally sudo-ed + group_user = self.env['ir.model.data'].xmlid_to_res_id('base.group_user') for recipient in recipients: if recipient.id in done_ids: continue - if not recipient.user_ids: - group_data['partner'] |= recipient - else: + if recipient.user_ids and group_user in recipient.user_ids[0].groups_id.ids: group_data['user'] |= recipient + else: + group_data['partner'] |= recipient return group_data @api.multi