Improve display for member equity payments

This commit is contained in:
Lance Edgar 2023-09-07 17:41:47 -05:00
parent b1ec1b8817
commit ecf46fa6fe

View file

@ -144,9 +144,10 @@ class MemberView(MasterView):
rows_title = "Equity Payments"
row_grid_columns = [
'amount',
'received',
'amount',
'description',
'source',
'transaction_identifier',
]
@ -408,18 +409,22 @@ class MemberEquityPaymentView(MasterView):
has_versions = True
grid_columns = [
'received',
'_member_key_',
'member',
'amount',
'received',
'description',
'source',
'transaction_identifier',
]
form_fields = [
'_member_key_',
'member',
'amount',
'received',
'description',
'source',
'transaction_identifier',
]
@ -435,14 +440,31 @@ class MemberEquityPaymentView(MasterView):
super().configure_grid(g)
model = self.model
# member_key
field = self.get_member_key_field()
attr = getattr(model.Member, field)
g.set_renderer(field, self.render_member_key)
g.set_filter(field, attr,
label=self.get_member_key_label(),
default_active=True)
g.set_sorter(field, attr)
# member (name)
g.set_joiner('member', lambda q: q.outerjoin(model.Person))
g.set_sorter('member', model.Person.display_name)
g.set_link('member')
g.set_filter('member', model.Person.display_name,
label="Member Name")
g.set_type('amount', 'currency')
g.set_sort_defaults('received', 'desc')
g.set_link('received')
g.set_link('transaction_identifier')
def render_member_key(self, payment, field):
key = getattr(payment.member, field)
return key
def configure_form(self, f):
super().configure_form(f)