[FIX] mass_mailing: unsubscribe error if contacts

If the mass mailing was to mail contacts, this could cause an error if
the recipient unsubscribed. If the mass mailing was to mailing list,
unsubscribe would not work.

This change update unsubscribe to take into account changes in 765e752
and e15372c07 that allowed mailing list / mailing list contacts to be
used separately.

opw-770473
closes #20145
This commit is contained in:
Nicolas Lempereur
2017-10-13 17:16:13 +02:00
parent 9866322a3d
commit f4332118d3
+2 -2
View File
@@ -16,10 +16,10 @@ class MassMailController(http.Controller):
if mailing.exists():
res_id = res_id and int(res_id)
res_ids = []
if mailing.mailing_model == 'mail.mass_mailing.contact':
if mailing.mailing_model == 'mail.mass_mailing.list':
contacts = request.env['mail.mass_mailing.contact'].sudo().search([
('email', '=', email),
('list_id', 'in', [mailing_list.id for mailing_list in mailing.contact_list_ids])
('list_ids', 'in', [mailing_list.id for mailing_list in mailing.contact_list_ids])
])
res_ids = contacts.ids
else: