[IMP] calendar: Ensure a warning is properly displayed on private chatter

Purpose
=======

Currently the chatter of a private event is unavailable to excluded users
but a end user might be confused as no explanation message is currently
displayed on the chatter.

closes odoo/odoo#120545

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
Yannick Tivisse
2023-05-04 23:30:49 +02:00
parent c8a5d8e993
commit ad0a4faa7d
+8
View File
@@ -718,6 +718,14 @@ class Meeting(models.Model):
copied_event.write({'partner_ids': [(Command.set(self.partner_ids.ids))]})
return copied_event
@api.model
def _get_mail_message_access(self, res_ids, operation, model_name=None):
if operation == 'read' and (not model_name or model_name == 'event.event'):
for event in self.browse(res_ids):
if event.privacy == "private" and self.env.user.partner_id not in event.attendee_ids.partner_id:
return 'write'
return super()._get_mail_message_access(res_ids, operation, model_name=model_name)
def _attendees_values(self, partner_commands):
"""
:param partner_commands: ORM commands for partner_id field (0 and 1 commands not supported)