Show "true" (calculated) equity total in members grid
pretty sure will need to tweak this but wanted something in place at least
This commit is contained in:
parent
abca0115a6
commit
d329b2945c
|
@ -122,6 +122,7 @@ class MemberView(MasterView):
|
|||
'equity_current',
|
||||
'joined',
|
||||
'withdrew',
|
||||
'equity_total',
|
||||
]
|
||||
|
||||
form_fields = [
|
||||
|
@ -168,7 +169,7 @@ class MemberView(MasterView):
|
|||
return app.get_people_handler().get_quickie_search_placeholder()
|
||||
|
||||
def configure_grid(self, g):
|
||||
super(MemberView, self).configure_grid(g)
|
||||
super().configure_grid(g)
|
||||
route_prefix = self.get_route_prefix()
|
||||
model = self.model
|
||||
|
||||
|
@ -179,10 +180,14 @@ class MemberView(MasterView):
|
|||
g.set_sort_defaults(field)
|
||||
g.set_link(field)
|
||||
|
||||
# person
|
||||
g.set_link('person')
|
||||
g.set_joiner('person', lambda q: q.outerjoin(model.Person))
|
||||
g.set_sorter('person', model.Person.display_name)
|
||||
g.set_filter('person', model.Person.display_name)
|
||||
|
||||
# customer
|
||||
g.set_link('customer')
|
||||
g.set_joiner('customer', lambda q: q.outerjoin(model.Customer))
|
||||
g.set_sorter('customer', model.Customer.name)
|
||||
g.set_filter('customer', model.Customer.name)
|
||||
|
@ -223,8 +228,17 @@ class MemberView(MasterView):
|
|||
g.main_actions.insert(1, self.make_action(
|
||||
'view_raw', url=url, icon='eye'))
|
||||
|
||||
g.set_link('person')
|
||||
g.set_link('customer')
|
||||
# equity_total
|
||||
# TODO: should make this configurable
|
||||
# g.set_type('equity_total', 'currency')
|
||||
g.set_renderer('equity_total', self.render_equity_total)
|
||||
g.remove_sorter('equity_total')
|
||||
g.remove_filter('equity_total')
|
||||
|
||||
def render_equity_total(self, member, field):
|
||||
app = self.get_rattail_app()
|
||||
equity = app.get_membership_handler().get_equity_total(member, cached=False)
|
||||
return app.render_currency(equity)
|
||||
|
||||
def default_view_url(self):
|
||||
if (self.request.has_perm('people.view_profile')
|
||||
|
|
Loading…
Reference in a new issue