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'
def get_model(self, key):
model = super(CustomerCrud, self).get_model(key)
if model:
return model
model = Session.query(model.Customer).filter_by(id=key).first()
if model:
return model
model = Session.query(model.CustomerPerson).get(key)
if model:
return model.customer
model = Session.query(model.CustomerGroupAssignment).get(key)
if model:
return model.customer
customer = super(CustomerCrud, self).get_model(key)
if customer:
return customer
customer = Session.query(model.Customer).filter_by(id=key).first()
if customer:
return customer
person = Session.query(model.CustomerPerson).get(key)
if person:
return person.customer
group = Session.query(model.CustomerGroupAssignment).get(key)
if group:
return group.customer
return None
def fieldset(self, model):