[IMP] mail.compose.message: not filter the context for attachment but overwrite the value with type=binary

bzr revid: chm@openerp.com-20121116114348-2g80ll85rz3ha0o2
This commit is contained in:
Christophe Matthieu 2012-11-16 12:43:48 +01:00
parent 8246fb56f8
commit 0cec2d9d06
1 changed files with 2 additions and 9 deletions

View File

@ -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)