[FIX] mail: effectively allow to post when notified on unreachable documents
When being notified on a document they cannot read users should be able to post, as indicated in message ACLs. However some data preparation prevents from doing it as ACLs are raised on document level. In this commit we sudo the call to display_name to populate record_name when not given. Indeed access is checked at message level so no need to crash in this specific use case. Task-3213982 (Mail: fix 'multi-company' post support) X-original-commit: odoo/odoo@2d73c61136 Part-of: odoo/odoo#114511
This commit is contained in:
@@ -2011,7 +2011,9 @@ class MailThread(models.AbstractModel):
|
||||
if 'email_add_signature' not in msg_values:
|
||||
msg_values['email_add_signature'] = True
|
||||
if not msg_values.get('record_name'):
|
||||
msg_values['record_name'] = self.display_name
|
||||
# use sudo as record access is not always granted (notably when replying
|
||||
# a notification) -> final check is done at message creation level
|
||||
msg_values['record_name'] = self.sudo().display_name
|
||||
msg_values.update({
|
||||
# author
|
||||
'author_id': author_id,
|
||||
|
||||
Reference in New Issue
Block a user