"""
Check if the organizer of the event is the only one who has accepted the event.
It does not apply if the organizer is the only attendee of the event because it
would represent a personnal event.
The goal of this field is to highlight to the user that the others attendees are
not available for this event.
"""
for event in self:
organizer = event.attendee_ids.filtered(lambda a: a.partner_id == event.partner_id)
all_declined = not any((event.attendee_ids - organizer).filtered(lambda a: a.state != 'declined'))
event.is_organizer_alone = len(event.attendee_ids) > 1 and all_declined
|