[FIX] mail: set user_id to an inactive user partner sends a mail to the object partner_id

Before this revision,
Assigning a user for which its partner is inactive
was sending the assignation notification email to the `partner_id`
of the object.

e.g. Assigning a task to a user for which its partner is disabled
sent the assignation notification email to the customer of the task.

opw-787659
This commit is contained in:
Denis Ledoux
2017-12-22 16:53:33 +01:00
parent 1ce4f15c39
commit 2946d78dd7
+1 -1
View File
@@ -2142,7 +2142,7 @@ class MailThread(models.AbstractModel):
# add followers coming from res.users relational fields that are tracked
user_ids = [values[name] for name in user_field_lst if values.get(name)]
user_pids = [user.partner_id.id for user in self.env['res.users'].sudo().browse(user_ids)]
user_pids = [user.partner_id.id for user in self.env['res.users'].sudo().browse(user_ids) if user.partner_id.active]
for partner_id in user_pids:
new_partners.setdefault(partner_id, None)