From 0fe50a01d2d4969f2a4cf85c36c2884407ccc682 Mon Sep 17 00:00:00 2001 From: David Beguin Date: Thu, 25 Oct 2018 15:55:02 +0000 Subject: [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 --- addons/mass_mailing/controllers/main.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'addons/mass_mailing/controllers/main.py') diff --git a/addons/mass_mailing/controllers/main.py b/addons/mass_mailing/controllers/main.py index 7d43038a3a6..66d17709b46 100644 --- a/addons/mass_mailing/controllers/main.py +++ b/addons/mass_mailing/controllers/main.py @@ -39,7 +39,7 @@ class MassMailController(http.Controller): # Unsubscribe directly + Let the user choose his subscriptions mailing.update_opt_out(email, mailing.contact_list_ids.ids, True) - contacts = request.env['mail.mass_mailing.contact'].sudo().search([('email', '=', email)]) + contacts = request.env['mail.mass_mailing.contact'].sudo().search([('email_normalized', '=ilike', email)]) subscription_list_ids = contacts.mapped('subscription_list_ids') # In many user are found : if user is opt_out on the list with contact_id 1 but not with contact_id 2, # assume that the user is not opt_out on both @@ -152,8 +152,7 @@ class MassMailController(http.Controller): if not self._valid_unsubscribe_token(mailing_id, res_id, email, token): return 'unauthorized' model = request.env[mailing.mailing_model_real] - [email_field] = model._primary_email - records = model.sudo().search([(email_field, '=ilike', email)]) + records = model.sudo().search([('email_normalized', '=ilike', email)]) for record in records: record.sudo().message_post(body=_("Feedback from %s: %s" % (email, feedback))) return bool(records) -- cgit v1.2.3