From c4133ec2eb019f15aaee0158b0601983f4ebf91d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 17 Jun 2022 13:06:57 +0000 Subject: [PATCH] [FIX] mail: do not fetch followers in user_notification mode When fetching recipients information for user_notification we don't need to check for followers, as only explicit recipients are considered. Task-2859935 Part-of: odoo/odoo#92868 --- addons/mail/models/mail_followers.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/mail/models/mail_followers.py b/addons/mail/models/mail_followers.py index 65a17ee314a..4710d1eb1ae 100644 --- a/addons/mail/models/mail_followers.py +++ b/addons/mail/models/mail_followers.py @@ -113,8 +113,9 @@ class Followers(models.Model): self.env['res.users'].flush_model(['notification_type', 'active', 'partner_id', 'groups_id']) self.env['res.partner'].flush_model(['active', 'partner_share']) self.env['res.groups'].flush_model(['users']) - # if we have records and a subtype: we have to fetch followers - if records and subtype_id: + # if we have records and a subtype: we have to fetch followers, unless being + # in user notification mode (contact only pids) + if message_type != 'user_notification' and records and subtype_id: query = """ WITH sub_followers AS ( SELECT fol.partner_id AS pid,