Expose member barcodes

This commit is contained in:
Lance Edgar 2021-01-13 23:06:06 -06:00
parent 6bed4db1f6
commit 32b04334a3

View file

@ -95,6 +95,7 @@ class MemberView(CoreOfficeMasterView):
'email2',
'ads_ok',
'dates',
'barcodes',
]
def configure_grid(self, g):
@ -111,6 +112,8 @@ class MemberView(CoreOfficeMasterView):
f.set_renderer('dates', self.render_member_dates)
f.set_renderer('barcodes', self.render_barcodes)
f.append('customers')
f.set_readonly('customers')
f.set_renderer('customers', self.render_customers)
@ -124,6 +127,22 @@ class MemberView(CoreOfficeMasterView):
items.append(HTML.tag('li', c=str(dates)))
return HTML.tag('ul', c=items)
def render_barcodes(self, member, field):
barcodes = member.barcodes
if not barcodes:
return
items = []
for barcode in barcodes:
if barcode.upc:
text = barcode.upc
elif barcode.upc is None:
text = "(null)"
else:
text = "(empty string)"
items.append(HTML.tag('li', c=[text]))
return HTML.tag('ul', c=items)
def render_customers(self, member, field):
customers = member.customers
if not customers: