Skip to content

Commit 3891e0f

Browse files
committed
[FIX] event_sale: call to parent store trigger resolver fails due to class mismatch for <unbound_method>
bzr revid: [email protected]
1 parent 048c4c2 commit 3891e0f

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

addons/event/event.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def _get_events_from_registrations(self, cr, uid, ids, context=None):
131131
@return: Dictionary of function field values.
132132
"""
133133
event_ids=set()
134-
for registration in self.browse(cr, uid, ids, context=context):
134+
for registration in self.pool['event.registration'].browse(cr, uid, ids, context=context):
135135
event_ids.add(registration.event_id.id)
136136
return list(event_ids)
137137

addons/event_sale/event_sale.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,16 @@ def _get_tickets(self, cr, uid, context={}):
139139
return []
140140

141141
def _get_ticket_events(self, cr, uid, ids, context=None):
142-
# `self` is the event.event.ticket model here!
142+
# `self` is the event.event.ticket model when called by ORM!
143143
return list(set(ticket.event_id.id
144144
for ticket in self.browse(cr, uid, ids, context)))
145145

146+
# proxy method, can't import parent method directly as unbound_method: it would receive
147+
# an invalid `self` <event_registration> when called by ORM
148+
def _events_from_registrations(self, cr, uid, ids, context=None):
149+
# `self` is the event.registration model when called by ORM
150+
return self.pool['event.event']._get_events_from_registrations(cr, uid, ids, context=context)
151+
146152
_columns = {
147153
'event_ticket_ids': fields.one2many('event.event.ticket', "event_id", "Event Ticket"),
148154
'seats_max': fields.function(_get_seats_max,
@@ -154,7 +160,7 @@ def _get_ticket_events(self, cr, uid, ids, context=None):
154160
'seats_available': fields.function(Event._get_seats, oldname='register_avail', string='Available Seats',
155161
type='integer', multi='seats_reserved',
156162
store={
157-
'event.registration': (Event._get_events_from_registrations, ['state'], 10),
163+
'event.registration': (_events_from_registrations, ['state'], 10),
158164
'event.event': (lambda self, cr, uid, ids, c = {}: ids,
159165
['seats_max', 'registration_ids'], 20),
160166
'event.event.ticket': (_get_ticket_events, ['seats_max'], 10),

0 commit comments

Comments
 (0)