|
|
for event in self:
if event.calendar_id and event.calendar_id.id in self.env.user.writable_calendar_ids.ids:
event.user_can_edit = True
continue
# By default, only current attendees, the organizer and the creator can edit the event.
editor_candidates = set(event.partner_ids.user_ids + event.user_id + (event.create_uid or self.env.user))
# Right before saving the event, old partners must be able to save changes.
if event._origin:
editor_candidates |= set(event._origin.partner_ids.user_ids)
# Non-private events must be editable by uninvited administrators.
if self.env.user.has_group('base.group_system') and event.privacy != 'private':
editor_candidates.add(self.env.user)
event.user_can_edit = self.env.user in editor_candidates
|
|