Improve support for "receive from scratch" workflow, esp. for mobile
also try harder to make certain aspects easier to enable/disable via handler, e.g. whether cases should be allowed as quantity input, or expired credits should be a thing etc.
This commit is contained in:
parent
a34a42d2b2
commit
d8b45db331
13 changed files with 330 additions and 149 deletions
|
@ -48,7 +48,6 @@ from rattail.progress import SocketProgress
|
|||
|
||||
import colander
|
||||
import deform
|
||||
from pyramid import httpexceptions
|
||||
from pyramid.renderers import render_to_response
|
||||
from pyramid.response import FileResponse
|
||||
from webhelpers2.html import HTML, tags
|
||||
|
@ -1074,20 +1073,11 @@ class BatchMasterView(MasterView):
|
|||
def get_parent(self, row):
|
||||
return row.batch
|
||||
|
||||
def delete_row(self):
|
||||
def delete_row_object(self, row):
|
||||
"""
|
||||
"Delete" a row from the batch. This sets the ``removed`` flag on the
|
||||
row but does not truly delete it.
|
||||
Perform the actual deletion of given row object.
|
||||
"""
|
||||
row = self.Session.query(self.model_row_class).get(self.request.matchdict['row_uuid'])
|
||||
if not row:
|
||||
raise httpexceptions.HTTPNotFound()
|
||||
row.removed = True
|
||||
batch = self.get_parent(row)
|
||||
self.handler.refresh_batch_status(batch)
|
||||
if batch.rowcount is not None:
|
||||
batch.rowcount -= 1
|
||||
return self.redirect(self.get_action_url('view', batch))
|
||||
self.handler.remove_row(row)
|
||||
|
||||
def bulk_delete_rows(self):
|
||||
"""
|
||||
|
@ -1096,9 +1086,14 @@ class BatchMasterView(MasterView):
|
|||
"""
|
||||
batch = self.get_instance()
|
||||
query = self.get_effective_row_data(sort=False)
|
||||
|
||||
# TODO: this should surely be handled by the handler...
|
||||
if batch.rowcount is not None:
|
||||
batch.rowcount -= query.count()
|
||||
query.update({'removed': True}, synchronize_session=False)
|
||||
self.Session.refresh(batch)
|
||||
self.handler.refresh_batch_status(batch)
|
||||
|
||||
return self.redirect(self.get_action_url('view', batch))
|
||||
|
||||
def execute(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue