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

Inputs Method Outputs
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

Back to entity