[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
This commit is contained in:
Yannick Tivisse
2016-02-08 15:40:24 +01:00
parent 243d207ad6
commit 0b7990cbce
+4 -3
View File
@@ -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