summaryrefslogtreecommitdiff
path: root/addons/mail/models/mail_thread.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-08-20 12:17:04 +0200
committerChristophe Simonis <chs@odoo.com>2019-08-20 12:17:04 +0200
commitf26de445e5579913e27ea6a630bcee6d40eefc7d (patch)
tree8b8e06be8a9d5fd3c1e5c31634611127446b9948 /addons/mail/models/mail_thread.py
parentbc6accc5688d3c38a35949751779f808e9c2063f (diff)
parent6f55fd65da8c50d36ca97654a920fb075076f125 (diff)
[MERGE] forward port branch saas-12.3 up to 6f55fd65da8
Diffstat (limited to 'addons/mail/models/mail_thread.py')
-rw-r--r--addons/mail/models/mail_thread.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py
index 3536c4e6001..9d1bd8c4d01 100644
--- a/addons/mail/models/mail_thread.py
+++ b/addons/mail/models/mail_thread.py
@@ -937,7 +937,7 @@ class MailThread(models.AbstractModel):
# 1. Check if message is a reply on a thread
msg_references = [ref for ref in tools.mail_header_msgid_re.findall(thread_references) if 'reply_to' not in ref]
- mail_messages = MailMessage.sudo().search([('message_id', 'in', msg_references)], limit=1)
+ mail_messages = MailMessage.sudo().search([('message_id', 'in', msg_references)], limit=1, order='id desc, message_id')
is_a_reply = bool(mail_messages)
# 1.1 Handle forward to an alias with a different model: do not consider it as a reply
@@ -1365,7 +1365,7 @@ class MailThread(models.AbstractModel):
# Very unusual situation, be we should be fault-tolerant here
message_id = "<%s@localhost>" % time.time()
_logger.debug('Parsing Message without message-id, generating a random one: %s', message_id)
- msg_dict['message_id'] = message_id
+ msg_dict['message_id'] = message_id.strip()
if message.get('Subject'):
msg_dict['subject'] = tools.decode_smtp_header(message.get('Subject'))