[FIX] mass_mailing: send mail to partner without email

When you send a mass mailing to muiltiple partner, if some of them have
no email adresse, it can lead to errors because of the variable 'recips'
is not set if the first occurence in the 'for loop' has no email.

To fix this, we always set the variable 'recips' by replacing the 'elif'
close by a 'else' one

introduced in rev: https://github.com/odoo/odoo/commit/65ed4553a50fdbefc986b7d21f87a81c42b743c7
This commit is contained in:
Pierre Masereel
2017-05-04 18:16:46 +02:00
parent 9dc53b620c
commit 2c666af5d1
@@ -61,8 +61,8 @@ class MailComposeMessage(models.TransientModel):
mail_values = res[res_id]
if mail_values.get('email_to'):
recips = tools.email_split(mail_values['email_to'])
elif mail_values.get('recipient_ids') and partners_email.get(res_id):
recips = tools.email_split(partners_email[res_id])
else:
recips = tools.email_split(partners_email.get(res_id))
mail_to = recips[0].lower() if recips else False
if (blacklist and mail_to in blacklist) or (seen_list and mail_to in seen_list):
# prevent sending to blocked addresses that were included by mistake