[FIX] mail: notify all partners of the thread
As stated in the comment: ``` all notified_partner_ids of the mail.message have to be notified for the parented messages ``` Record rules are applied when browsing one2many fields. Therefore, when browsing `message.notified_partner_ids` with a user other than the SUPERUSER, the multi-company rules are applied, and a regular user could therefore not see all partners of the thread, according to which company the partners are associated with. Nevertheless, all partners of the thread have to be notified, including the ones the regular user cannot see. To reproduce the issue: - Create a second company 'Second company' - Create a third user, associated to the first company 'YourCompany' - Set the demo user as in the 'Second company' - Create a project 'test' in the first company, 'YourCompany' - In the followers of the project, add the Demo user, with as subtypes "Stages changes" only - As the third user, create a new task in this project - Change the stage of this task, as the third user [this is important] - Sign in as the demo user, and see that you cannot access your messages inbox, due to an access rights error. opw-650563
This commit is contained in:
parent
70847ac5c0
commit
12f77fa22f
|
@ -848,7 +848,7 @@ class mail_message(osv.Model):
|
|||
Call mail_notification.notify to manage the email sending
|
||||
"""
|
||||
notification_obj = self.pool.get('mail.notification')
|
||||
message = self.browse(cr, uid, newid, context=context)
|
||||
message = self.browse(cr, SUPERUSER_ID, newid, context=context)
|
||||
partners_to_notify = set([])
|
||||
|
||||
# all followers of the mail.message document have to be added as partners and notified if a subtype is defined (otherwise: log message)
|
||||
|
|
|
@ -1861,7 +1861,7 @@ class mail_thread(osv.AbstractModel):
|
|||
if msg_ids:
|
||||
notification_obj = self.pool.get('mail.notification')
|
||||
notification_obj._notify(cr, uid, msg_ids[0], partners_to_notify=partner_ids, context=context)
|
||||
message = message_obj.browse(cr, uid, msg_ids[0], context=context)
|
||||
message = message_obj.browse(cr, SUPERUSER_ID, msg_ids[0], context=context)
|
||||
if message.parent_id:
|
||||
partner_ids_to_parent_notify = set(partner_ids).difference(partner.id for partner in message.parent_id.notified_partner_ids)
|
||||
for partner_id in partner_ids_to_parent_notify:
|
||||
|
|
Loading…
Reference in New Issue