Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.
Module: Events
Entity: event.event
Compute Method: _compute_is_participating
| Inputs | Method | Outputs |
|---|---|---|
|
|
- """Heuristic - - * public, no visitor: not participating as we have no information; - * check only confirmed and attended registrations, a draft registration - does not make the attendee participating; - * public and visitor: check visitor is linked to a registration. As - visitors are merged on the top parent, current visitor check is - sufficient even for successive visits; - * logged, no visitor: check partner is linked to a registration. Do - not check the email as it is not really secure; - * logged as visitor: check partner or visitor are linked to a - registration; - """ - current_visitor = self.env['website.visitor']._get_visitor_from_request(force_create=False) - base_domain = [('event_id', 'in', self.ids), ('state', 'in', ['open', 'done'])] - if self.env.user._is_public() and not current_visitor: - events = self.env['event.event'] - elif self.env.user._is_public(): - events = self.env['event.registration'].sudo().search( - expression.AND([base_domain, [('visitor_id', '=', current_visitor.id)]]) - ).event_id - else: - if current_visitor: - domain = [ - '|', - ('partner_id', '=', self.env.user.partner_id.id), - ('visitor_id', '=', current_visitor.id) - ] - else: - domain = [('partner_id', '=', self.env.user.partner_id.id)] - events = self.env['event.registration'].sudo().search( - expression.AND([base_domain, domain]) - ).event_id - for event in self: - event.is_participating = event in events + participating_events = self._fetch_is_participating_events() + participating_events.is_participating = True + (self - participating_events).is_participating = False |
|
