Add CORE supplement for Member Equity Payments view

This commit is contained in:
Lance Edgar 2023-09-07 17:50:17 -05:00
parent 8b30d52c1b
commit a34e2b61f5

View file

@ -85,6 +85,56 @@ class MemberViewSupplement(ViewSupplement):
return [tags.link_to("View CORE-POS Member", url)] return [tags.link_to("View CORE-POS Member", url)]
class MemberEquityPaymentViewSupplement(ViewSupplement):
"""
Member view supplement for CORE integration
"""
route_prefix = 'member_equity_payments'
labels = {
'corepos_card_number': "CORE-POS Card Number",
'corepos_transaction_number': "CORE-POS Transaction Number",
'corepos_transaction_id': "CORE-POS Transaction ID",
'corepos_department_number': "CORE-POS Department Number",
}
def get_grid_query(self, query):
model = self.model
return query.outerjoin(model.CoreMemberEquityPayment)
def configure_grid(self, g):
model = self.model
g.set_filter('corepos_card_number', model.CoreMemberEquityPayment.corepos_card_number)
g.set_sorter('corepos_card_number', model.CoreMemberEquityPayment.corepos_card_number)
g.set_filter('corepos_transaction_number', model.CoreMemberEquityPayment.corepos_transaction_number)
g.set_sorter('corepos_transaction_number', model.CoreMemberEquityPayment.corepos_transaction_number)
g.set_filter('corepos_transaction_id', model.CoreMemberEquityPayment.corepos_transaction_id)
g.set_sorter('corepos_transaction_id', model.CoreMemberEquityPayment.corepos_transaction_id)
g.set_filter('corepos_department_number', model.CoreMemberEquityPayment.corepos_department_number)
g.set_sorter('corepos_department_number', model.CoreMemberEquityPayment.corepos_department_number)
g.append('corepos_transaction_number')
g.set_label('corepos_transaction_number', "CORE-POS Trans. No.")
if 'corepos_transaction_number' in g.filters:
g.filters['corepos_transaction_number'].label = self.labels['corepos_transaction_number']
g.set_link('corepos_transaction_number')
def configure_form(self, f):
f.append('corepos_card_number')
f.append('corepos_transaction_number')
f.append('corepos_transaction_id')
f.append('corepos_department_number')
def get_version_child_classes(self):
model = self.model
return [model.CoreMemberEquityPayment]
def includeme(config): def includeme(config):
MembershipTypeViewSupplement.defaults(config) MembershipTypeViewSupplement.defaults(config)
MemberViewSupplement.defaults(config) MemberViewSupplement.defaults(config)
MemberEquityPaymentViewSupplement.defaults(config)