[MERGE] bug fix 730632
bzr revid: tfr@openerp.com-20110310103951-dapqhvwa3enikc7d
This commit is contained in:
commit
6d3ffe53aa
|
@ -128,6 +128,10 @@ class mailgate_thread(osv.osv):
|
|||
for case in cases:
|
||||
attachments = []
|
||||
for att in attach:
|
||||
att_ids = att_obj.search(cr, uid, [('name','=',att[0]), ('res_id', '=', case.id)])
|
||||
if att_ids:
|
||||
attachments.append(att_ids[0])
|
||||
else:
|
||||
attachments.append(att_obj.create(cr, uid, {'res_model':case._name,'res_id':case.id, 'name': att[0], 'datas': base64.encodestring(att[1])}))
|
||||
|
||||
partner_id = hasattr(case, 'partner_id') and (case.partner_id and case.partner_id.id or False) or False
|
||||
|
@ -169,7 +173,7 @@ class mailgate_thread(osv.osv):
|
|||
'message_id': message_id,
|
||||
'attachment_ids': [(6, 0, attachments)]
|
||||
}
|
||||
|
||||
|
||||
obj.create(cr, uid, data, context=context)
|
||||
return True
|
||||
mailgate_thread()
|
||||
|
@ -221,7 +225,7 @@ class mailgate_message(osv.osv):
|
|||
action_data = False
|
||||
action_pool = self.pool.get('ir.actions.act_window')
|
||||
message_pool = self.browse(cr ,uid, ids, context=context)[0]
|
||||
att_ids = [x.id for x in message_pool.attachment_ids]
|
||||
att_ids = [x.id for x in message_pool.attachment_ids]
|
||||
action_ids = action_pool.search(cr, uid, [('res_model', '=', 'ir.attachment')])
|
||||
if action_ids:
|
||||
action_data = action_pool.read(cr, uid, action_ids[0], context=context)
|
||||
|
|
Loading…
Reference in New Issue