[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.
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user