Tweak default/basic batch CRUD fieldset a little.

This commit is contained in:
Lance Edgar 2015-08-18 23:50:23 -05:00
parent 3d44e3e857
commit 5f1c60e362

View file

@ -404,8 +404,10 @@ class BatchCrud(BaseCrud):
override this, but :meth:`configure_fieldset()` instead. override this, but :meth:`configure_fieldset()` instead.
""" """
fs = self.make_fieldset(model) fs = self.make_fieldset(model)
fs.created.set(renderer=DateTimeFieldRenderer(self.request.rattail_config)) fs.created.set(renderer=DateTimeFieldRenderer(self.request.rattail_config),
fs.created_by.set(label="Created by", renderer=UserFieldRenderer) readonly=True)
fs.created_by.set(label="Created by", renderer=UserFieldRenderer,
readonly=True)
fs.cognized.set(renderer=DateTimeFieldRenderer(self.request.rattail_config)) fs.cognized.set(renderer=DateTimeFieldRenderer(self.request.rattail_config))
fs.cognized_by.set(label="Cognized by", renderer=UserFieldRenderer) fs.cognized_by.set(label="Cognized by", renderer=UserFieldRenderer)
fs.executed.set(renderer=DateTimeFieldRenderer(self.request.rattail_config)) fs.executed.set(renderer=DateTimeFieldRenderer(self.request.rattail_config))
@ -422,6 +424,13 @@ class BatchCrud(BaseCrud):
del fs.executed del fs.executed
if 'executed_by' in fs.render_fields: if 'executed_by' in fs.render_fields:
del fs.executed_by del fs.executed_by
else:
batch = fs.model
if not batch.executed:
if 'executed' in fs.render_fields:
del fs.executed
if 'executed_by' in fs.render_fields:
del fs.executed_by
return fs return fs
def configure_fieldset(self, fieldset): def configure_fieldset(self, fieldset):