@api.multi
@api.depends('seats_max', 'registration_ids.state')
def _compute_seats(self):
    ' Determine reserved, available, reserved but unconfirmed and used seats. '
    for ticket in self:
        ticket.seats_availability = ('unlimited' if (ticket.seats_max == 0) else 'limited')
        ticket.seats_unconfirmed = ticket.seats_reserved = ticket.seats_used = ticket.seats_available = 0
    if self.ids:
        state_field = {'draft': 'seats_unconfirmed', 'open': 'seats_reserved', 'done': 'seats_used'}
        query = " SELECT event_ticket_id, state, count(event_id)\n                        FROM event_registration\n                        WHERE event_ticket_id IN %s AND state IN ('draft', 'open', 'done')\n                        GROUP BY event_ticket_id, state\n                    "
        self.env.cr.execute(query, (tuple(self.ids),))
        for (event_ticket_id, state, num) in self.env.cr.fetchall():
            ticket = self.browse(event_ticket_id)
            ticket[state_field[state]] += num
    for ticket in self:
        if (ticket.seats_max > 0):
            ticket.seats_available = (ticket.seats_max - (ticket.seats_reserved + ticket.seats_used))
Determine reserved, available, reserved but unconfirmed and used seats.
@api.multi
@api.depends('seats_max', 'registration_ids.state')
def _compute_seats(self):
    '  '
    for ticket in self:
        ticket.seats_availability = ('unlimited' if (ticket.seats_max == 0) else 'limited')
        ticket.seats_unconfirmed = ticket.seats_reserved = ticket.seats_used = ticket.seats_available = 0
    if self.ids:
        state_field = {'draft': 'seats_unconfirmed', 'open': 'seats_reserved', 'done': 'seats_used'}
        query = " SELECT event_ticket_id, state, count(event_id)\n                        FROM event_registration\n                        WHERE event_ticket_id IN %s AND state IN ('draft', 'open', 'done')\n                        GROUP BY event_ticket_id, state\n                    "
        self.env.cr.execute(query, (tuple(self.ids),))
        for (event_ticket_id, state, num) in self.env.cr.fetchall():
            ticket = self.browse(event_ticket_id)
            ticket[state_field[state]] += num
    for ticket in self:
        if (ticket.seats_max > 0):
            ticket.seats_available = (ticket.seats_max - (ticket.seats_reserved + ticket.seats_used))