summaryrefslogtreecommitdiff
path: root/addons/mail/mail_thread.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2014-10-21 14:59:56 +0200
committerChristophe Simonis <chs@odoo.com>2014-10-21 14:59:56 +0200
commita42167d085e8c4989412c39ec4e21685ebd93cd2 (patch)
treefc8cf942fe689de94aec631d5b8d7365693de5d0 /addons/mail/mail_thread.py
parentd822766296fed8f72d3168c675d4cf0b89e73f0c (diff)
parent262eb662de489d98b76dece7305b594399161014 (diff)
[MERGE] forward port of branch 8.0 up to 262eb66
Diffstat (limited to 'addons/mail/mail_thread.py')
-rw-r--r--addons/mail/mail_thread.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py
index 495b8418045..4356ee676ca 100644
--- a/addons/mail/mail_thread.py
+++ b/addons/mail/mail_thread.py
@@ -1612,7 +1612,9 @@ class mail_thread(osv.AbstractModel):
# _mail_flat_thread: automatically set free messages to the first posted message
if self._mail_flat_thread and model and not parent_id and thread_id:
- message_ids = mail_message.search(cr, uid, ['&', ('res_id', '=', thread_id), ('model', '=', model)], context=context, order="id ASC", limit=1)
+ message_ids = mail_message.search(cr, uid, ['&', ('res_id', '=', thread_id), ('model', '=', model), ('type', '=', 'email')], context=context, order="id ASC", limit=1)
+ if not message_ids:
+ message_ids = message_ids = mail_message.search(cr, uid, ['&', ('res_id', '=', thread_id), ('model', '=', model)], context=context, order="id ASC", limit=1)
parent_id = message_ids and message_ids[0] or False
# we want to set a parent: force to set the parent_id to the oldest ancestor, to avoid having more than 1 level of thread
elif parent_id: