From a37bd778954468f4414f36d29b397ec334cb5b71 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 7 Mar 2016 11:19:44 +0100 Subject: [PATCH] [FIX] mail: mark all as read, remove notification as sudo As it's done few lines below, in `set_message_done`. The user could have a notication associated to a message he has not, or no longer, the write access, but he should still be able to mark it as read. opw-671188 --- 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 6e97df905cb..05224add86a 100644 --- a/addons/mail/models/mail_message.py +++ b/addons/mail/models/mail_message.py @@ -175,7 +175,7 @@ class Message(models.Model): if channel_ids: msg_domain += [('channel_ids', 'in', channel_ids)] unread_messages = self.search(expression.AND([msg_domain, domain])) - unread_messages.write({'needaction_partner_ids': [(3, partner_id)]}) + unread_messages.sudo().write({'needaction_partner_ids': [(3, partner_id)]}) ids = unread_messages.mapped('id') notification = {'type': 'mark_as_read', 'message_ids': ids, 'channel_ids': channel_ids}