From: Thibault Delavallée Date: Fri, 21 Dec 2012 10:03:52 +0000 (+0100) Subject: [IMP] message_process: author of incoming emails that are partner are automatically... X-Git-Tag: 7.0-server~204^2~5 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=c88008856e88ce9f50d6b0ebbc072aa24c079b92;p=odoo%2Fodoo.git [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 --- diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 48bdef5..d980f00 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -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