From 0cec2d9d0612f568b662ad9578eafa8a0087cfb8 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Fri, 16 Nov 2012 12:43:48 +0100 Subject: [PATCH] [IMP] mail.compose.message: not filter the context for attachment but overwrite the value with type=binary bzr revid: chm@openerp.com-20121116114348-2g80ll85rz3ha0o2 --- addons/email_template/wizard/mail_compose_message.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/addons/email_template/wizard/mail_compose_message.py b/addons/email_template/wizard/mail_compose_message.py index 3d52dc34b93..e9141029166 100644 --- a/addons/email_template/wizard/mail_compose_message.py +++ b/addons/email_template/wizard/mail_compose_message.py @@ -95,14 +95,6 @@ class mail_compose_message(osv.TransientModel): # transform attachments into attachment_ids values['attachment_ids'] = [] ir_attach_obj = self.pool.get('ir.attachment') - - # filter context values - context_attach = dict({ - 'tz': context.get('tz'), - 'lang': context.get('lang'), - 'bin_raw': context.get('bin_raw'), - }) - for attach_fname, attach_datas in values.pop('attachments', []): data_attach = { 'name': attach_fname, @@ -110,8 +102,9 @@ class mail_compose_message(osv.TransientModel): 'datas_fname': attach_fname, 'res_model': model, 'res_id': res_id, + 'type': 'binary', # overwrite the context default_value } - values['attachment_ids'].append(ir_attach_obj.create(cr, uid, data_attach, context=context_attach)) + values['attachment_ids'].append(ir_attach_obj.create(cr, uid, data_attach, context=context)) else: values = self.default_get(cr, uid, ['body', 'body_html', 'subject', 'partner_ids', 'attachment_ids'], context=context)