Fix bug in batch ID field renderer, when displayed for new batch
Hopefully this is a good idea..
This commit is contained in:
parent
1327b886fc
commit
4757a56002
|
@ -40,9 +40,15 @@ class BatchIDFieldRenderer(fa.FieldRenderer):
|
|||
Renderer for batch ID fields.
|
||||
"""
|
||||
def render_readonly(self, **kwargs):
|
||||
batch_id = self.raw_value
|
||||
if batch_id:
|
||||
return '{:08d}'.format(batch_id)
|
||||
try:
|
||||
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:
|
||||
return '{:08d}'.format(batch_id)
|
||||
return ''
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue