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