From 6f7262f508d96ac856c0769d3494afddbbbaa17a Mon Sep 17 00:00:00 2001 From: Toufik Ben Jaa Date: Thu, 15 Nov 2018 14:10:07 +0000 Subject: [PATCH] [FIX] mail: do no try to send notification to inactive users - This commit prevent to send notifications to inactive users. - This fixes a bug where two partners have been merged and one of its users is archived. If one of the two users is inactive the code might use its `notification type` preferences instead of the active user's one. closes odoo/odoo#28730 --- addons/mail/models/mail_followers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mail/models/mail_followers.py b/addons/mail/models/mail_followers.py index 6392a60466b..f4f16c2e9f0 100644 --- a/addons/mail/models/mail_followers.py +++ b/addons/mail/models/mail_followers.py @@ -114,7 +114,7 @@ SELECT partner.id as pid, NULL AS cid, partner.active as active, partner.partner_share as pshare, NULL as ctype, users.notification_type AS notif, array_agg(groups.id) AS groups FROM res_partner partner - LEFT JOIN res_users users ON users.partner_id = partner.id + LEFT JOIN res_users users ON users.partner_id = partner.id AND users.active LEFT JOIN res_groups_users_rel groups_rel ON groups_rel.uid = users.id LEFT JOIN res_groups groups ON groups.id = groups_rel.gid WHERE EXISTS ( @@ -148,7 +148,7 @@ SELECT partner.id as pid, NULL AS cid, partner.active as active, partner.partner_share as pshare, NULL as ctype, users.notification_type AS notif, NULL AS groups FROM res_partner partner -LEFT JOIN res_users users ON users.partner_id = partner.id +LEFT JOIN res_users users ON users.partner_id = partner.id AND users.active WHERE partner.id IN %s""" params.append(tuple(pids)) if cids: