Fix bug in batch ID field renderer, when displayed for new batch

Hopefully this is a good idea..
This commit is contained in:
Lance Edgar 2016-10-16 03:32:00 -05:00
parent 1327b886fc
commit 4757a56002

View file

@ -40,9 +40,15 @@ class BatchIDFieldRenderer(fa.FieldRenderer):
Renderer for batch ID fields. Renderer for batch ID fields.
""" """
def render_readonly(self, **kwargs): def render_readonly(self, **kwargs):
batch_id = self.raw_value try:
if batch_id: batch_id = self.raw_value
return '{:08d}'.format(batch_id) except AttributeError:
# this can happen when creating a new batch, b/c the default value
# comes from a sequence
pass
else:
if batch_id:
return '{:08d}'.format(batch_id)
return '' return ''