[IMP] message_process: author of incoming emails that are partner are automatically...
authorThibault Delavallée <tde@openerp.com>
Fri, 21 Dec 2012 10:03:52 +0000 (11:03 +0100)
committerThibault Delavallée <tde@openerp.com>
Fri, 21 Dec 2012 10:03:52 +0000 (11:03 +0100)
bzr revid: tde@openerp.com-20121221100352-eraewn17t2ls831q

addons/mail/mail_thread.py

index 48bdef5..d980f00 100644 (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