From 7afdfc5046d1f43fe3f9f9e67d79a591ab7d915d Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Fri, 18 Jan 2019 14:26:41 +0000 Subject: [PATCH] [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 10d558ef2be2eb 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 --- addons/mail/models/mail_message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/models/mail_message.py b/addons/mail/models/mail_message.py index 677925b561c..f07af1c524f 100644 --- a/addons/mail/models/mail_message.py +++ b/addons/mail/models/mail_message.py @@ -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