Let batch view customize logic for marking batch as (in)complete

This commit is contained in:
Lance Edgar 2019-01-09 14:18:30 -06:00
parent 98fc4608da
commit 051cb71956

View file

@ -491,17 +491,26 @@ class BatchMasterView(MasterView):
else:
form = forms.Form(schema=ToggleComplete(), request=self.request)
if form.validate(newstyle=True):
batch.complete = form.validated['complete']
if form.validated['complete']:
self.mark_batch_complete(batch)
else:
self.mark_batch_incomplete(batch)
return self.redirect(self.get_action_url('view', batch))
def mark_batch_complete(self, batch):
batch.complete = True
def mark_batch_incomplete(self, batch):
batch.complete = False
def mobile_mark_complete(self):
batch = self.get_instance()
batch.complete = True
self.mark_batch_complete(batch)
return self.redirect(self.get_index_url(mobile=True))
def mobile_mark_pending(self):
batch = self.get_instance()
batch.complete = False
self.mark_batch_incomplete(batch)
return self.redirect(self.get_action_url('view', batch, mobile=True))
def rows_creatable_for(self, batch):