summaryrefslogtreecommitdiff
path: root/addons/mail/models/mail_thread.py
diff options
context:
space:
mode:
authorhelly kapatel <hpl@odoo.com>2019-10-21 10:28:08 +0000
committerjpr-odoo <jpr@openerp.com>2020-02-06 16:57:41 +0000
commit7f0ebad5cc0c0e16c3d6a881b2968e6ccb16dabd (patch)
tree9cfe24076a02ee6b8e038532b3b8f653aff50396 /addons/mail/models/mail_thread.py
parent7954594d12b0d801fd3802c66d5c6caa521d2ce2 (diff)
[FIX] mail: fix issue when posting a message on a document whose first message / parent is not readable
How to reproduce ================ Have a portal user commenting a task on the customer portal. He may experience a crash if previous message / first message is not available, for example if it is internal or not published. This is due to reference computation used in outgoing emails as it is based on parent messageID. Accessing it crashes although it should not as it is used only for technical purpose. Fix === In this comme we fix that issue by browsing the reference message as sudo to access its messageID. A test is added to avoid regressions. Task ID 2061760 PR #36845 closes odoo/odoo#44765 X-original-commit: e94349ed65e05a40af6e690e366de81fc5aa6725 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com> Co-authored-by: jpr-odoo <jpr@openerp.com>
Diffstat (limited to 'addons/mail/models/mail_thread.py')
-rw-r--r--addons/mail/models/mail_thread.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py
index 82309efe62d..b36a866ca5f 100644
--- a/addons/mail/models/mail_thread.py
+++ b/addons/mail/models/mail_thread.py
@@ -2287,7 +2287,8 @@ class MailThread(models.AbstractModel):
'mail_message_id': message.id,
'mail_server_id': message.mail_server_id.id, # 2 query, check acces + read, may be useless, Falsy, when will it be used?
'auto_delete': mail_auto_delete,
- 'references': message.parent_id.message_id if message.parent_id else False,
+ # due to ir.rule, user have no right to access parent message if message is not published
+ 'references': message.parent_id.sudo().message_id if message.parent_id else False,
'subject': mail_subject,
}
headers = self._notify_email_headers()