[FIX] calendar: Error stop displaying private name

Step to reproduce:
- Two internal users, A and B
- As A, create a calendar event and set its privacy to private
- As B, display everybody's calendar
- Double click on the private event created by A
- Click on save

Current Behaviour:
- True name is shown as part of the error

Behaviour After PR:
- For private event not related to the users, 'Busy' or it's translation is shown to the user

opw-2723904

closes odoo/odoo#82485

X-original-commit: 704a47a520c789906b7e98ef48e5cb4f6592a13a
Signed-off-by: Damhaut Florian (flda) <flda@odoo.com>
This commit is contained in:
Florian Damhaut
2022-01-11 08:36:45 +00:00
parent 4e18c501b8
commit 386e54c9e2
+15
View File
@@ -550,6 +550,21 @@ class Meeting(models.Model):
return True
def name_get(self):
""" Hide private events' name for events which don't belong to the current user
"""
hidden = self.filtered(
lambda evt:
evt.privacy == 'private' and
evt.user_id.id != self.env.uid and
self.env.user.partner_id not in evt.partner_ids
)
shown = self - hidden
shown_names = super(Meeting, shown).name_get()
obfuscated_names = [(eid, _('Busy')) for eid in hidden.ids]
return shown_names + obfuscated_names
@api.model
def read_group(self, domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True):
groupby = [groupby] if isinstance(groupby, str) else groupby