diff options
| author | David Beguin <dbe@odoo.com> | 2018-08-29 16:38:52 +0200 |
|---|---|---|
| committer | David Beguin <dbe@odoo.com> | 2018-08-30 09:45:58 +0200 |
| commit | e7871625f69e6f318794c4d1c8c53e4b0b0380dc (patch) | |
| tree | fb7439943da44785913cd7e3ab7552e108f88e76 /addons/mass_mailing/controllers/main.py | |
| parent | a409dd3d3181914d4003d387603bbb31fb4ad00f (diff) | |
[FIX] mail, mass_mailing: remove user error if remove unexisting record from blacklist
In unsubscribe page, if the user try to come back
(and be removed from the blacklist)
but his email have been deleted from the blacklist,
it was leading to an error.
Instead, and in order to keep a trace of what the user asked,
if the email is not found in the blacklist, the record will be
created but archived directly.
Also, it aligns the return of both methods _add/_remove
Diffstat (limited to 'addons/mass_mailing/controllers/main.py')
| -rw-r--r-- | addons/mass_mailing/controllers/main.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/mass_mailing/controllers/main.py b/addons/mass_mailing/controllers/main.py index cd0b14a5b45..5909a3a6433 100644 --- a/addons/mass_mailing/controllers/main.py +++ b/addons/mass_mailing/controllers/main.py @@ -124,7 +124,9 @@ class MassMailController(http.Controller): if mailing._unsubscribe_token(res_id, email) != token: return 'unauthorized' if email: - request.env['mail.blacklist'].sudo()._remove(email) + blacklist_rec = request.env['mail.blacklist'].sudo()._remove(email) + blacklist_rec._message_log(_("""The %s asked to be removed from the blacklist + using the unsubscription page.""" % request.env['ir.model']._get(mailing.mailing_model_real).display_name)) return True return 'error' |
