[IMP] message_process: author of incoming emails that are partner are automatically subscribed to the created or updated document.

bzr revid: tde@openerp.com-20121221100352-eraewn17t2ls831q
This commit is contained in:
Thibault Delavallée 2012-12-21 11:03:52 +01:00
parent b37450ba49
commit c88008856e
1 changed files with 5 additions and 1 deletions

View File

@ -446,7 +446,7 @@ class mail_thread(osv.AbstractModel):
(msg['message_id'], model)
# disabled subscriptions during message_new/update to avoid having the system user running the
# email gateway become a follower of all inbound messages
# email gateway become a follower of all inbound messages
nosub_ctx = dict(context, mail_nosubscribe=True)
if thread_id and hasattr(model_pool, 'message_update'):
model_pool.message_update(cr, user_id, [thread_id], msg, context=nosub_ctx)
@ -457,6 +457,10 @@ class mail_thread(osv.AbstractModel):
model_pool = self.pool.get('mail.thread')
new_msg_id = model_pool.message_post_user_api(cr, uid, [thread_id], context=context, content_subtype='html', **msg)
# when posting an incoming email to a document: subscribe the author, if a partner, as follower
if model and thread_id and msg.get('author_id'):
model_pool.message_subscribe(cr, uid, [thread_id], [msg.get('author_id')], context=context)
if partner_ids:
# postponed after message_post, because this is an external message and we don't want to create
# duplicate emails due to notifications