[FIX] mail_thread: in message_parse, correctly set partner_ids of the message dict. By the way small things in amil module.

bzr revid: tde@openerp.com-20121107105148-6o1dvu7f4ms24rbx
This commit is contained in:
Thibault Delavallée 2012-11-07 11:51:48 +01:00
parent c983fba3c3
commit f9829bbb93
3 changed files with 4 additions and 3 deletions

View File

@ -730,7 +730,7 @@ class mail_message(osv.Model):
], context=context)
fol_objs = fol_obj.read(cr, uid, fol_ids, ['partner_id'], context=context)
partners_to_notify |= set(fol['partner_id'][0] for fol in fol_objs)
# when writing to a wall
# remove me from notified partners, unless the message is written on my own wall
if message.get('author_id') and message.get('model') == "res.partner" and message.get('res_id') == message.get('author_id')[0]:
partners_to_notify |= set([message.get('author_id')[0]])
elif message.get('author_id'):

View File

@ -588,7 +588,7 @@ class mail_thread(osv.AbstractModel):
else:
msg_dict['email_from'] = message.get('from')
partner_ids = self._message_find_partners(cr, uid, message, ['From', 'To', 'Cc'], context=context)
msg_dict['partner_ids'] = partner_ids
msg_dict['partner_ids'] = [(4, partner_id) for partner_id in partner_ids]
if 'Date' in message:
date_hdr = decode(message.get('Date'))

View File

@ -54,7 +54,8 @@ class res_partner_mail(osv.Model):
thread_id = thread_id[0]
if type == 'email':
partner_ids = kwargs.get('partner_ids', [])
partner_ids.append(thread_id)
if thread_id not in partner_ids:
partner_ids.append(thread_id)
kwargs['partner_ids'] = partner_ids
return super(res_partner_mail, self).message_post(cr, uid, False, body=body, subject=subject,
type=type, subtype=subtype, parent_id=parent_id, attachments=attachments, context=context, **kwargs)