[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
This commit is contained in:
parent
0fc73a2067
commit
fac04424ca
|
@ -883,11 +883,14 @@ class mail_message(osv.Model):
|
||||||
# An error appear when a user receive a notification without notifying
|
# An error appear when a user receive a notification without notifying
|
||||||
# the parent message -> add a read notification for the parent
|
# the parent message -> add a read notification for the parent
|
||||||
if message.parent_id:
|
if message.parent_id:
|
||||||
# all notified_partner_ids of the mail.message have to be notified for the parented messages
|
parent_id = message.parent_id
|
||||||
partners_to_parent_notify = set(message.notified_partner_ids).difference(message.parent_id.notified_partner_ids)
|
while parent_id:
|
||||||
for partner in partners_to_parent_notify:
|
# all notified_partner_ids of the mail.message have to be notified for the parented messages
|
||||||
notification_obj.create(cr, uid, {
|
partners_to_parent_notify = set(message.notified_partner_ids).difference(parent_id.notified_partner_ids)
|
||||||
'message_id': message.parent_id.id,
|
for partner in partners_to_parent_notify:
|
||||||
'partner_id': partner.id,
|
notification_obj.create(cr, uid, {
|
||||||
'is_read': True,
|
'message_id': parent_id.id,
|
||||||
}, context=context)
|
'partner_id': partner.id,
|
||||||
|
'is_read': True,
|
||||||
|
}, context=context)
|
||||||
|
parent_id = parent_id.parent_id
|
||||||
|
|
Loading…
Reference in New Issue