[FIX] mail: fix mailing wizard when partners and template specified

if partner_ids and template_id are set, a traceback happens.

Indeed, some mail fields are not taken from the res_ids when partner_ids
is set.

When trying to update the values with the one from the template, the
existing values are popped, which raised an error as those keys weren't
set.

closes odoo/odoo#38434

X-original-commit: c8ad614718674b55e9af5edd062ded958136e7ac
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
Victor Feyens
2019-10-10 16:39:09 +00:00
committed by fw-bot
parent 04ada1ddae
commit 75f2d8444e
+3 -3
View File
@@ -508,9 +508,9 @@ class MailComposer(models.TransientModel):
for res_id in res_ids:
if template_values.get(res_id):
# recipients are managed by the template
results[res_id].pop('partner_ids')
results[res_id].pop('email_to')
results[res_id].pop('email_cc')
results[res_id].pop('partner_ids', None)
results[res_id].pop('email_to', None)
results[res_id].pop('email_cc', None)
# remove attachments from template values as they should not be rendered
template_values[res_id].pop('attachment_ids', None)
else: