Render "pretty" UPC by default, for batch row form fields

This commit is contained in:
Lance Edgar 2021-12-15 18:06:53 -06:00
parent 40d36f9808
commit bc7ccb6a9f

View file

@ -627,6 +627,11 @@ class BatchMasterView(MasterView):
return tags.link_to(text, url) return tags.link_to(text, url)
return text return text
def render_upc_pretty(self, row, field):
upc = getattr(row, field)
if upc:
return upc.pretty()
def render_row_status(self, row, column): def render_row_status(self, row, column):
code = row.status_code code = row.status_code
if code is None: if code is None:
@ -662,6 +667,10 @@ class BatchMasterView(MasterView):
# sequence # sequence
f.set_readonly('sequence') f.set_readonly('sequence')
# upc (default rendering, just in case there is such a field
# on our row model)
f.set_renderer('upc', self.render_upc_pretty)
# status_code # status_code
if self.model_row_class: if self.model_row_class:
f.set_enum('status_code', self.model_row_class.STATUS) f.set_enum('status_code', self.model_row_class.STATUS)