Fix some things for inventory batch views

This commit is contained in:
Lance Edgar 2018-05-23 14:13:28 -05:00
parent 62dca3d0b0
commit 57c2a7981f
2 changed files with 3 additions and 4 deletions

View file

@ -445,7 +445,9 @@ class BatchMasterView(MasterView):
def toggle_complete(self):
batch = self.get_instance()
if not batch.executed:
if batch.executed:
self.request.session.flash("Request ignored, since batch has already been executed")
else:
form = forms.Form(schema=ToggleComplete(), request=self.request)
if form.validate(newstyle=True):
batch.complete = form.validated['complete']

View file

@ -194,9 +194,6 @@ class InventoryBatchView(BatchMasterView):
batch.created_by,
localtime(self.request.rattail_config, batch.created, from_utc=True).strftime('%Y-%m-%d'))
def editable_instance(self, batch):
return True
def mutable_batch(self, batch):
return not batch.executed and not batch.complete and batch.mode != self.enum.INVENTORY_MODE_ZERO_ALL