Add way to hide "view profile" helper for customer view

This commit is contained in:
Lance Edgar 2019-07-03 12:35:14 -05:00
parent e9e4d65c78
commit bb0e2fb9e9
2 changed files with 8 additions and 1 deletions

View file

@ -21,7 +21,7 @@
<%def name="object_helpers()"> <%def name="object_helpers()">
${parent.object_helpers()} ${parent.object_helpers()}
% if instance.people: % if show_profiles_helper and instance.people:
${view_profiles_helper(instance.people)} ${view_profiles_helper(instance.people)}
% endif % endif
</%def> </%def>

View file

@ -54,6 +54,9 @@ class CustomersView(MasterView):
people_detachable = True people_detachable = True
touchable = True touchable = True
# whether to show "view full profile" helper for customer view
show_profiles_helper = True
labels = { labels = {
'id': "ID", 'id': "ID",
'default_phone': "Phone Number", 'default_phone': "Phone Number",
@ -245,6 +248,10 @@ class CustomersView(MasterView):
f.set_renderer('groups', self.render_groups) f.set_renderer('groups', self.render_groups)
f.set_readonly('groups') f.set_readonly('groups')
def template_kwargs_view(self, **kwargs):
kwargs['show_profiles_helper'] = self.show_profiles_helper
return kwargs
def unique_id(self, node, value): def unique_id(self, node, value):
query = self.Session.query(model.Customer)\ query = self.Session.query(model.Customer)\
.filter(model.Customer.id == value) .filter(model.Customer.id == value)