diff options
| author | Denis Ledoux <dle@odoo.com> | 2016-02-17 15:04:22 +0100 |
|---|---|---|
| committer | Denis Ledoux <dle@odoo.com> | 2016-02-17 15:11:05 +0100 |
| commit | b57461620362e1c4ff812f0ddbc87e5a8c3d00c0 (patch) | |
| tree | fa6b409ffc38d7e9ef8650ab6cdae86b6ab0e068 /addons/website_mass_mailing/controllers | |
| parent | ec1e5c524ba6c7fb40af337a2e6a18b19910a91e (diff) | |
[FIX] mass_mailing: unsubscribe route without website
The unsubscribe URL is used within the `mass_mailing` module,
e.g. in `_get_unsubscribe_url` & `send_get_email_dict`.
Basically, there is the possibility to add the unsubscription
link in the mass mailings while having only
`mass_mailing` installed.
But, the unsubscription route is defined within
the module `website_mass_mailing`.
Therefore, if you added the unsubscription link
within your mailings while not having
`website_mass_mailing` installed, trying
to follow the unsubscription link leaded to
a `404 Not Found` page.
We therefore define the route within `mass_mailing`
directly, which does the basic stuff (the basic
unsubscribe and confirmation), and override this route
in `website_mass_mailing`, where the advanced stuff is done
(the mailing lists list unsubscription and the better
looking page).
opw-669425
Diffstat (limited to 'addons/website_mass_mailing/controllers')
| -rw-r--r-- | addons/website_mass_mailing/controllers/main.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/addons/website_mass_mailing/controllers/main.py b/addons/website_mass_mailing/controllers/main.py index 5a67a326f6d..2a7596104a8 100644 --- a/addons/website_mass_mailing/controllers/main.py +++ b/addons/website_mass_mailing/controllers/main.py @@ -1,23 +1,24 @@ # -*- coding: utf-8 -*- from openerp import http, SUPERUSER_ID +from openerp.addons.mass_mailing.controllers.main import MassMailController from openerp.http import request -class MassMailController(http.Controller): +class MassMailController(MassMailController): @http.route(['/mail/mailing/<int:mailing_id>/unsubscribe'], type='http', website=True, auth='public') def mailing(self, mailing_id, email=None, res_id=None, **post): mailing = request.env['mail.mass_mailing'].sudo().browse(mailing_id) if mailing.exists(): if mailing.mailing_model == 'mail.mass_mailing.contact': - contacts = request.env['mail.mass_mailing.contact'].sudo().search([('email', 'ilike', email)]) + contacts = request.env['mail.mass_mailing.contact'].sudo().search([('email', '=', email)]) return request.website.render('website_mass_mailing.page_unsubscribe', { 'contacts': contacts, 'email': email, 'mailing_id': mailing_id}) else: - mailing.update_opt_out(mailing_id, email, [res_id], True) + super(MassMailController, self).mailing(mailing_id, email=email, res_id=res_id, **post) return request.website.render('website_mass_mailing.page_unsubscribed') @http.route(['/mail/mailing/unsubscribe'], type='json', auth='none') |
