Fix customer lookup bug in customer detail view.

This commit is contained in:
Lance Edgar 2014-01-26 13:17:15 -08:00
parent c4257809e5
commit a6226700f1

View file

@ -106,18 +106,18 @@ class CustomerCrud(CrudView):
home_route = 'customers' home_route = 'customers'
def get_model(self, key): def get_model(self, key):
model = super(CustomerCrud, self).get_model(key) customer = super(CustomerCrud, self).get_model(key)
if model: if customer:
return model return customer
model = Session.query(model.Customer).filter_by(id=key).first() customer = Session.query(model.Customer).filter_by(id=key).first()
if model: if customer:
return model return customer
model = Session.query(model.CustomerPerson).get(key) person = Session.query(model.CustomerPerson).get(key)
if model: if person:
return model.customer return person.customer
model = Session.query(model.CustomerGroupAssignment).get(key) group = Session.query(model.CustomerGroupAssignment).get(key)
if model: if group:
return model.customer return group.customer
return None return None
def fieldset(self, model): def fieldset(self, model):