[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
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user