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

Module: Events Organization

Entity: event.registration

Compute Method: _compute_remaining_entries

View 20.0
Inputs Method Outputs
  • ticket_entry_limit
  • main_registration_id
  • state
+ sub_registrations = dict(self.env['event.registration']._read_group(
+             domain=[('main_registration_id', 'in', self.ids), ('state', '=', 'done')],
+             groupby=['main_registration_id'],
+             aggregates=['__count']
+         ))
+ for registration in self:
+             if registration.ticket_entry_limit > 1 and not registration.main_registration_id and registration.state != 'done':
+                 registration.remaining_entries = max(0, (registration.ticket_entry_limit - sub_registrations.get(registration, 0)))
+             else:
+                 registration.remaining_entries = 0
  • remaining_entries

Back to entity