Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Calendar

Entity: calendar.event

Compute Method: _compute_user_can_edit

View 18.0 View 20.0
Inputs Method Outputs
  • partner_ids
  • partner_ids.user_ids
  • user_id
  • privacy
  • calendar_id
  • calendar_id.id
  • create_uid
for event in self:
-             # By default, only current attendees and the organizer can edit the event.
-             editor_candidates = set(event.partner_ids.user_ids + event.user_id)
+             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
  • user_can_edit

Back to entity