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/mass_mailing/controllers/main.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/mass_mailing/controllers/main.py')
| -rw-r--r-- | addons/mass_mailing/controllers/main.py | 5 |
1 files changed, 2 insertions, 3 deletions
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) |
