summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToufik Ben Jaa <tbe@odoo.com>2018-11-15 14:10:07 +0000
committerToufik Ben Jaa <tbe@odoo.com>2018-11-16 11:13:56 +0000
commit6f7262f508d96ac856c0769d3494afddbbbaa17a (patch)
tree465ed205bc528461411ded0ec0c86f1e938f7429
parent8ee02ad136189f52316ac5aa0c205414d67c1d3f (diff)
[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
-rw-r--r--addons/mail/models/mail_followers.py4
1 files 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: