[MERGE] mail.thread: allow re-entry in message_post in case of cross-model notifications via message_process

bzr revid: odo@openerp.com-20130215103902-xeg14cg2fnn5uz85
This commit is contained in:
Olivier Dony
2013-02-15 11:39:02 +01:00
+7 -2
View File
@@ -592,7 +592,7 @@ class mail_thread(osv.AbstractModel):
thread_id = False
for model, thread_id, custom_values, user_id in routes:
if self._name != model:
if self._name == 'mail.thread':
context.update({'thread_model': model})
if model:
model_pool = self.pool.get(model)
@@ -883,7 +883,12 @@ class mail_thread(osv.AbstractModel):
if isinstance(thread_id, (list, tuple)):
thread_id = thread_id and thread_id[0]
mail_message = self.pool.get('mail.message')
model = context.get('thread_model', self._name) if thread_id else False
# if we're processing a message directly coming from the gateway, the destination model was
# set in the context.
model = False
if thread_id:
model = context.get('thread_model', self._name) if self._name == 'mail.thread' else self._name
attachment_ids = kwargs.pop('attachment_ids', [])
for name, content in attachments: