From 7eb5b82950cc2dac83056e3b66d5d77283ef68fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 31 Aug 2012 19:16:22 +0200 Subject: [PATCH] [FIX] email_template: generate_email now returns a standard-looking attachments in values (list of tuples). bzr revid: tde@openerp.com-20120831171622-ibrrz5us0lunoi0q --- addons/email_template/email_template.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index 17b7004be41..19344acf233 100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -313,8 +313,8 @@ class email_template(osv.osv): model=template.model, res_id=res_id or False) - attachments = {} - # Add report as a Document + attachments = [] + # Add report in attachments if template.report_template: report_name = self.render_template(cr, uid, template.report_name, template.model, res_id, context=context) report_service = 'report.' + report_xml_pool.browse(cr, uid, template.report_template.id, context).report_name @@ -330,12 +330,11 @@ class email_template(osv.osv): ext = "." + format if not report_name.endswith(ext): report_name += ext - attachments[report_name] = result + attachments.append(report_name, result) - # Add document attachments + # Add template attachments for attach in template.attachment_ids: - # keep the bytes as fetched from the db, base64 encoded - attachments[attach.datas_fname] = attach.datas + attachments.append(attach.datas_fname, attach.datas) values['attachments'] = attachments return values