[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
This commit is contained in:
Thibault Delavallée
2022-06-18 10:23:02 +02:00
parent fd5c6a861c
commit c4133ec2eb
+3 -2
View File
@@ -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,