Add view supplement for CustomerShopper

This commit is contained in:
Lance Edgar 2023-06-11 20:56:18 -05:00
parent b896e30409
commit 15d4086da2

View file

@ -75,5 +75,34 @@ class CustomerViewSupplement(ViewSupplement):
return [tags.link_to("View CORE-POS Member", url)]
class CustomerShopperViewSupplement(ViewSupplement):
"""
CustomerShopper view supplement for CORE integration
"""
route_prefix = 'customer_shoppers'
labels = {
'corepos_customer_id': "CORE-POS Customer ID",
}
def get_grid_query(self, query):
model = self.model
return query.outerjoin(model.CoreCustomerShopper)
def configure_grid(self, g):
model = self.model
g.append('corepos_customer_id')
g.set_filter('corepos_customer_id', model.CoreCustomerShopper.corepos_customer_id)
def configure_form(self, f):
if not self.master.creating:
f.append('corepos_customer_id')
def get_version_child_classes(self):
model = self.model
return [model.CoreCustomerShopper]
def includeme(config):
CustomerViewSupplement.defaults(config)
CustomerShopperViewSupplement.defaults(config)