[FIX] email_template: fixed wrong res_id given to attachments in send_mail (should be a mail.message res_id, not a mail.mail res_id), to use the low-level attachments unlink.

bzr revid: tde@openerp.com-20130422102114-a179ylzpgu3g6vcr
This commit is contained in:
Thibault Delavallée 2013-04-22 12:21:14 +02:00
parent ef210bd489
commit 856083e2b4
1 changed files with 2 additions and 1 deletions

View File

@ -381,6 +381,7 @@ class email_template(osv.osv):
attachment_ids = values.pop('attachment_ids', [])
attachments = values.pop('attachments', [])
msg_id = mail_mail.create(cr, uid, values, context=context)
mail = mail_mail.browse(cr, uid, msg_id, context=context)
# manage attachments
for attachment in attachments:
@ -389,7 +390,7 @@ class email_template(osv.osv):
'datas_fname': attachment[0],
'datas': attachment[1],
'res_model': 'mail.message',
'res_id': msg_id,
'res_id': mail.mail_message_id.id,
}
context.pop('default_type', None)
attachment_ids.append(ir_attachment.create(cr, uid, attachment_data, context=context))