diff options
| author | gla <gla@odoo.com> | 2018-10-11 09:44:32 +0000 |
|---|---|---|
| committer | Geoffroy Larue <gla@odoo.com> | 2018-10-26 15:03:29 +0000 |
| commit | 42c6db1ece58f45b574e9df15919339ab4ca71d3 (patch) | |
| tree | 562170e089df914b9ec60f151fc70cda6d1ed572 /addons/mass_mailing/controllers/main.py | |
| parent | e10fd34682a0c55568cba66eb271b3aa5bed7c1d (diff) | |
[IMP] mass_mailing: warn when unsubscribing
Current behavior before PR:
When a lead or res.partner click in the 'unsubscribe' link in a mail that was sent to him via the mass mailing module (not via a particular mailing list), he is blacklisted from the whole mass mailing system. The only message he gets is "you have been successfully unsubscribed".
Desired behavior after PR is merged:
The user is told that he was unsubscribed, but in addition a warning is displayed telling him explicitly :
- to which mailing lists he was subscribed
- that he won't receive any mail from them anymore.
Purpose : Warn the user that unsubscribe via a lead or res.partner mass mailing that he won't receive any mail from the mailing lists (listed in the warning) he had subscribed, if any.
closes odoo/odoo#27678
Diffstat (limited to 'addons/mass_mailing/controllers/main.py')
| -rw-r--r-- | addons/mass_mailing/controllers/main.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/addons/mass_mailing/controllers/main.py b/addons/mass_mailing/controllers/main.py index 18b8a814dac..7d43038a3a6 100644 --- a/addons/mass_mailing/controllers/main.py +++ b/addons/mass_mailing/controllers/main.py @@ -62,6 +62,10 @@ class MassMailController(http.Controller): 'show_blacklist_button': request.env['ir.config_parameter'].sudo().get_param('mass_mailing.show_blacklist_buttons'), }) else: + opt_in_lists = request.env['mail.mass_mailing.list_contact_rel'].sudo().search([ + ('contact_id.email', '=', email), + ('opt_out', '=', False) + ]).mapped('list_id') blacklist_rec = request.env['mail.blacklist'].sudo()._add(email) self._log_blacklist_action( blacklist_rec, mailing_id, @@ -70,6 +74,7 @@ class MassMailController(http.Controller): 'email': email, 'mailing_id': mailing_id, 'res_id': res_id, + 'list_ids': opt_in_lists, 'show_blacklist_button': request.env['ir.config_parameter'].sudo().get_param( 'mass_mailing.show_blacklist_buttons'), }) |
