[FIX] mail: retrieve mail (sent by OdooBot) failure notification in multicompany

Let the database be in multi-company without a shared contact book.
Have user U in company B, OdooBot in company A.
From a record R created by U, have a message sent by OdooBot fail to be sent.
A new failure notification failure should be displayed for U in company B.
Have U switch from and to company B.
The failure notifications are fetched, with their info.
Commit 10d558ef2b made sure that the user had access to the record
before trying to display the notification.
However in that case U has access to R, but trying to access the mail sender
violates the inter-company record rule, since OdooBot is in another company (A).

opw 1928100
opw 1935303
opw 1939352

closes odoo/odoo#30364
This commit is contained in:
Lucas Perais (lpe)
2019-02-12 13:04:30 +00:00
committed by Nans Lefebvre
parent 8c3fa3dd3e
commit 7afdfc5046
+1 -1
View File
@@ -553,7 +553,7 @@ class Message(models.Model):
'model': message.model,
'last_message_date': message.date,
'module_icon': '/mail/static/src/img/smiley/mailfailure.jpg',
'notifications': dict((notif.res_partner_id.id, (notif.email_status, notif.res_partner_id.name)) for notif in message.notification_ids)
'notifications': dict((notif.res_partner_id.id, (notif.email_status, notif.res_partner_id.name)) for notif in message.notification_ids.sudo())
}
failures_infos.append(info)
return failures_infos