From 80cef9e8c52ff7dc0715a7478a2288d3de7065df Mon Sep 17 00:00:00 2001 From: Nicolas Seinlet Date: Mon, 22 Oct 2018 12:45:05 +0000 Subject: [PATCH] [FIX] mail: faster blacklist search For the special case of is_blacklisted, and due to the size of the tablers to handle, it's faster to filter some records rather than searching the whole res.partner table closes odoo/odoo#28028 --- addons/mail/models/mail_channel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/models/mail_channel.py b/addons/mail/models/mail_channel.py index 497f32fe628..17d11c89401 100644 --- a/addons/mail/models/mail_channel.py +++ b/addons/mail/models/mail_channel.py @@ -340,7 +340,7 @@ class Channel(models.Model): @api.multi def _notify_email_recipients(self, message, recipient_ids): # Excluded Blacklisted - whitelist = self.env['res.partner'].sudo().search([('id', 'in', recipient_ids), ('is_blacklisted', '=', False)]) + whitelist = self.env['res.partner'].sudo().search([('id', 'in', recipient_ids)]).filtered(lambda p: not p.is_blacklisted) # real mailing list: multiple recipients (hidden by X-Forge-To) if self.alias_domain and self.alias_name: return {