diff options
| author | David Beguin <dbe@odoo.com> | 2018-10-25 15:55:02 +0000 |
|---|---|---|
| committer | David Beguin <dbe@odoo.com> | 2018-11-20 11:37:05 +0000 |
| commit | 0fe50a01d2d4969f2a4cf85c36c2884407ccc682 (patch) | |
| tree | 188d3348d4f84a9184cb009e233de4744ccd0c82 /addons/mail/wizard/mail_compose_message.py | |
| parent | 8d3fcf42c9e1f1aedaf5dae0f3776c0efbe7644f (diff) | |
[IMP] mail : apply mail.address.mixin on blacklist
Apply the mail.address.mixin on blacklist mixin. So that every model
inheriting the blacklist.mixin will also inherit the address.mixin.
That simplify also the comparaison to - and the searches on - the
blacklist.
Task ID 1896677
Diffstat (limited to 'addons/mail/wizard/mail_compose_message.py')
| -rw-r--r-- | addons/mail/wizard/mail_compose_message.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py index 5422a115fdf..b9a5845896c 100644 --- a/addons/mail/wizard/mail_compose_message.py +++ b/addons/mail/wizard/mail_compose_message.py @@ -280,17 +280,14 @@ class MailComposer(models.TransientModel): reply_to_value = self.env['mail.thread']._notify_get_reply_to_on_records(default=self.email_from, records=records) blacklisted_rec_ids = [] - if mass_mail_mode and hasattr(self.env[self.model], "_primary_email"): + if mass_mail_mode and issubclass(type(self.env[self.model]), self.pool['mail.blacklist.mixin']): BL_sudo = self.env['mail.blacklist'].sudo() blacklist = set(BL_sudo.search([]).mapped('email')) if blacklist: - [email_field] = self.env[self.model]._primary_email - targets = self.env[self.model].browse(res_ids).read([email_field]) + targets = self.env[self.model].browse(res_ids).read(['email_normalized']) # First extract email from recipient before comparing with blacklist - for target in targets: - sanitized_email = self.env['mail.blacklist']._sanitize_email(target.get(email_field)) - if sanitized_email and sanitized_email in blacklist: - blacklisted_rec_ids.append(target['id']) + blacklisted_rec_ids.extend([target['id'] for target in targets + if target['email_normalized'] and target['email_normalized'] in blacklist]) for res_id in res_ids: # static wizard (mail.message) values |
