Include version history for CustomerShopper, in profile view
This commit is contained in:
parent
9e1b83cbbe
commit
f1a8b8df7f
|
@ -1114,19 +1114,33 @@ class PersonView(MasterView):
|
|||
.filter(cls.parent_uuid == person.uuid)
|
||||
versions.extend(query.all())
|
||||
|
||||
# CustomerPerson
|
||||
cls = continuum.version_class(model.CustomerPerson)
|
||||
# Customer (account_holder)
|
||||
cls = continuum.version_class(model.Customer)
|
||||
query = self.Session.query(cls)\
|
||||
.filter(cls.person_uuid == person.uuid)
|
||||
.filter(cls.account_holder_uuid == person.uuid)
|
||||
versions.extend(query.all())
|
||||
|
||||
# Customer
|
||||
# Customer (new-style via CustomerShopper)
|
||||
cls = continuum.version_class(model.Customer)
|
||||
query = self.Session.query(cls)\
|
||||
.join(model.CustomerShopper,
|
||||
model.CustomerShopper.customer_uuid == cls.uuid)\
|
||||
.filter(model.CustomerShopper.person_uuid == person.uuid)
|
||||
versions.extend(query.all())
|
||||
|
||||
# Customer (old-style via CustomerPerson)
|
||||
cls = continuum.version_class(model.Customer)
|
||||
query = self.Session.query(cls)\
|
||||
.join(model.CustomerPerson, model.CustomerPerson.customer_uuid == cls.uuid)\
|
||||
.filter(model.CustomerPerson.person_uuid == person.uuid)
|
||||
versions.extend(query.all())
|
||||
|
||||
# CustomerPerson
|
||||
cls = continuum.version_class(model.CustomerPerson)
|
||||
query = self.Session.query(cls)\
|
||||
.filter(cls.person_uuid == person.uuid)
|
||||
versions.extend(query.all())
|
||||
|
||||
# nb. this is used in some queries below
|
||||
FirstShopper = orm.aliased(model.CustomerShopper)
|
||||
|
||||
|
|
Loading…
Reference in a new issue