Commit fac04424 authored by Goffin Simon's avatar Goffin Simon
Browse files

[FIX] mail: receiving a notification without notifying the parent message.

Used case:

If you add a user which has no acces on a model(ex:purchase.order)
as follower on a record of this model. When someone responded by email on
this record, and when a message is sent on this record, an exception is raised
at the connection of the user added as a follower.

Fix:

To have the rights to read the message, a read notification for this follower must
be added to all parents of this message.

Closes #11902

opw:676699
parent 0fc73a20
......@@ -883,11 +883,14 @@ class mail_message(osv.Model):
# An error appear when a user receive a notification without notifying
# the parent message -> add a read notification for the parent
if message.parent_id:
# all notified_partner_ids of the mail.message have to be notified for the parented messages
partners_to_parent_notify = set(message.notified_partner_ids).difference(message.parent_id.notified_partner_ids)
for partner in partners_to_parent_notify:
notification_obj.create(cr, uid, {
'message_id': message.parent_id.id,
'partner_id': partner.id,
'is_read': True,
}, context=context)
parent_id = message.parent_id
while parent_id:
# all notified_partner_ids of the mail.message have to be notified for the parented messages
partners_to_parent_notify = set(message.notified_partner_ids).difference(parent_id.notified_partner_ids)
for partner in partners_to_parent_notify:
notification_obj.create(cr, uid, {
'message_id': parent_id.id,
'partner_id': partner.id,
'is_read': True,
}, context=context)
parent_id = parent_id.parent_id
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment