From 856083e2b4e07a98192bd1d31fe4d6cc2c141b27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Mon, 22 Apr 2013 12:21:14 +0200 Subject: [PATCH] [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 --- addons/email_template/email_template.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index a602a447867..356d903b03d 100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -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))