From aaa8d07de0c3f7d1ca0473b200c80e863e07a1c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 24 Nov 2015 11:11:02 +0100 Subject: [PATCH] [FIX] survey: sending emails Emails are now send once by recipient. If there is a partner_id, use it as recipient using the correct recipient_ids field, not partner_ids (not the same meaning, recipients for emails use recipient_ids). Use the email_to if there is no partner_id. Indeed this method is called with partner_id and email being the same recipient. Also added auto delete to generated emails. As partner_ids is not used anymore the mails are not considered as notifications and stay in the mail_mail table. There is no need to stock those emails. --- addons/survey/wizard/survey_email_compose_message.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/survey/wizard/survey_email_compose_message.py b/addons/survey/wizard/survey_email_compose_message.py index 2e8ec907f0c..9a1de6b7df6 100644 --- a/addons/survey/wizard/survey_email_compose_message.py +++ b/addons/survey/wizard/survey_email_compose_message.py @@ -135,11 +135,14 @@ class survey_mail_compose_message(osv.TransientModel): 'body': wizard.body.replace("__URL__", url), 'body_html': wizard.body.replace("__URL__", url), 'parent_id': None, - 'partner_ids': partner_id and [(4, partner_id)] or None, 'attachment_ids': wizard.attachment_ids or None, 'email_from': wizard.email_from or None, - 'email_to': email, + 'auto_delete': True, } + if partner_id: + values['recipient_ids'] = [(4, partner_id)] + else: + values['email_to'] = email mail_id = mail_mail_obj.create(cr, uid, values, context=context) mail_mail_obj.send(cr, uid, [mail_id], context=context)