diff options
| author | Denis Ledoux <dle@odoo.com> | 2014-10-16 14:07:38 +0200 |
|---|---|---|
| committer | Denis Ledoux <dle@odoo.com> | 2014-10-16 14:07:38 +0200 |
| commit | 1d57a09112e4def7c7ed9cc010f9d683c18ac1ea (patch) | |
| tree | 35e4dae1d2de51f38d732643e8fe948d32d68300 /addons/mail/mail_thread.py | |
| parent | 9c0e8f10e0268c26cea1b991b0156f425a3c3e1a (diff) | |
[FIX] mail: set the parent_id to the first message of type email
And fallback of any type if there is none of type email
This fix allow the communication between two mail thread from two different Odoo servers having message creation subtypes, like project issue or crm lead
Diffstat (limited to 'addons/mail/mail_thread.py')
| -rw-r--r-- | addons/mail/mail_thread.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index ee039533af6..e82ed94c43b 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -1166,7 +1166,9 @@ class mail_thread(osv.AbstractModel): # _mail_flat_thread: automatically set free messages to the first posted message if self._mail_flat_thread 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: |
