From a6226700f1d7a5a46767166d17c94bcba1509957 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 26 Jan 2014 13:17:15 -0800 Subject: [PATCH] Fix customer lookup bug in customer detail view. --- tailbone/views/customers.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) 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):