Avoid legacy logic for Customer.people schema

This commit is contained in:
Lance Edgar 2023-09-11 17:13:07 -05:00
parent 60044d5cdf
commit e930199f83

View file

@ -146,14 +146,6 @@ 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)
return query
@ -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,16 +194,6 @@ 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)
# active_in_pos