Avoid legacy logic for Customer.people
schema
This commit is contained in:
parent
60044d5cdf
commit
e930199f83
|
@ -146,16 +146,8 @@ class CustomerView(MasterView):
|
|||
query = super().query(session)
|
||||
app = self.get_rattail_app()
|
||||
model = self.model
|
||||
if app.get_clientele_handler().should_use_legacy_people():
|
||||
query = query.outerjoin(model.CustomerPerson,
|
||||
sa.and_(
|
||||
model.CustomerPerson.customer_uuid == model.Customer.uuid,
|
||||
model.CustomerPerson.ordinal == 1))\
|
||||
.outerjoin(model.Person,
|
||||
model.Person.uuid == model.CustomerPerson.person_uuid)
|
||||
else:
|
||||
query = query.outerjoin(model.Person,
|
||||
model.Person.uuid == model.Customer.account_holder_uuid)
|
||||
query = query.outerjoin(model.Person,
|
||||
model.Person.uuid == model.Customer.account_holder_uuid)
|
||||
return query
|
||||
|
||||
def configure_grid(self, g):
|
||||
|
@ -163,7 +155,6 @@ class CustomerView(MasterView):
|
|||
app = self.get_rattail_app()
|
||||
model = self.model
|
||||
route_prefix = self.get_route_prefix()
|
||||
legacy = app.get_clientele_handler().should_use_legacy_people()
|
||||
|
||||
# customer key
|
||||
field = self.get_customer_key_field()
|
||||
|
@ -203,17 +194,7 @@ class CustomerView(MasterView):
|
|||
|
||||
# person
|
||||
g.set_renderer('person', self.grid_render_person)
|
||||
if legacy:
|
||||
LegacyPerson = orm.aliased(model.Person)
|
||||
g.set_joiner('person', lambda q:
|
||||
q.outerjoin(model.CustomerPerson,
|
||||
sa.and_(
|
||||
model.CustomerPerson.customer_uuid == model.Customer.uuid,
|
||||
model.CustomerPerson.ordinal == 1))\
|
||||
.outerjoin(LegacyPerson))
|
||||
g.set_sorter('person', LegacyPerson.display_name)
|
||||
else:
|
||||
g.set_sorter('person', model.Person.display_name)
|
||||
g.set_sorter('person', model.Person.display_name)
|
||||
|
||||
# active_in_pos
|
||||
if self.get_expose_active_in_pos():
|
||||
|
|
Loading…
Reference in a new issue