[FIX] mass-mailing: unsubscribe even when archived

A record (Partner/Lead) that was archived can still be unsubscribed.
This commit is contained in:
Olivier Dony 2017-05-10 19:05:48 +02:00
parent 180c769ab4
commit 3978713996
No known key found for this signature in database
GPG Key ID: CD556E25E8A6D0D4
1 changed files with 2 additions and 1 deletions

View File

@ -37,7 +37,8 @@ class MassMailController(http.Controller):
elif 'email' in model._fields:
email_fname = 'email'
if email_fname:
record_ids = model.search(cr, SUPERUSER_ID, [('id', '=', res_id), (email_fname, 'ilike', email)], context=context)
ctx = dict(context or {}, active_test=False)
record_ids = model.search(cr, SUPERUSER_ID, [('id', '=', res_id), (email_fname, 'ilike', email)], context=ctx)
if 'opt_out' in model._fields:
model.write(cr, SUPERUSER_ID, record_ids, {'opt_out': True}, context=context)
return 'OK'