diff --git a/tailbone/views/customers.py b/tailbone/views/customers.py index 8d0461eb..f6ada2c3 100644 --- a/tailbone/views/customers.py +++ b/tailbone/views/customers.py @@ -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):