Skip to content
Permalink
Browse files

[FIX] mass_mailing: correctly find partner email in mass mailing

In mass mailing access to partners when performing a mass mailing has been
done in batch to speedup computation [1]. Emails are put into a dictionary
allowing to find back the email based on partner_id.

However the matching between the partner and its emails is done using a
shortcut using the current document ID as partner ID. It works when performing
a mass mailing on partners but fails when performing a mass mailing on models
having message_get_default_recipients not returning only emails. Currently
in saas-14 main models return only emails (crm, event, mailing contacts) but
other models may encounter issues (applicants, tickets).

This commit fixes it by correctly matching partner id and its found email.

[1] See 65ed455
  • Loading branch information...
tde-banana-odoo committed Feb 12, 2019
1 parent e831064 commit 32c2af2376c27dc078206725f0c94697e237e8a7
Showing with 2 additions and 1 deletion.
  1. +2 −1 addons/mass_mailing/wizard/mail_compose_message.py
@@ -62,7 +62,8 @@ def get_mail_values(self, res_ids):
if mail_values.get('email_to'):
recips = tools.email_split(mail_values['email_to'])
else:
recips = tools.email_split(partners_email.get(res_id))
partner_id = (mail_values.get('recipient_ids') or [(False, '')])[0][1]
recips = tools.email_split(partners_email.get(partner_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

0 comments on commit 32c2af2

Please sign in to comment.
You can’t perform that action at this time.