Overhaul desktop views for receiving, for efficiency

still could use even more i'm sure, but this takes advantage of buefy
to add dialogs etc. from the "view receiving batch row" page.  this
batch no longer allows direct edit of rows but that's hopefully for
the better.
This commit is contained in:
Lance Edgar 2021-12-13 17:53:14 -06:00
parent 2f676774e9
commit 340a177a29
14 changed files with 1014 additions and 157 deletions

View file

@ -115,7 +115,9 @@ class BatchMasterView(MasterView):
def __init__(self, request):
super(BatchMasterView, self).__init__(request)
self.handler = self.get_handler()
self.batch_handler = self.get_handler()
# TODO: deprecate / remove this (?)
self.handler = self.batch_handler
@classmethod
def get_handler_factory(cls, rattail_config):
@ -1149,18 +1151,27 @@ class BatchMasterView(MasterView):
"""
Batch rows are editable only until batch is complete or executed.
"""
if not (self.rows_editable or self.rows_editable_but_not_directly):
return False
batch = self.get_parent(row)
return self.rows_editable and not batch.executed and not batch.complete
if batch.complete or batch.executed:
return False
return True
def row_deletable(self, row):
"""
Batch rows are deletable only until batch is complete or executed.
"""
if self.rows_deletable:
batch = self.get_parent(row)
if not batch.executed and not batch.complete:
return True
return False
if not self.rows_deletable:
return False
batch = self.get_parent(row)
if batch.complete or batch.executed:
return False
return True
def template_kwargs_view_row(self, **kwargs):
kwargs['batch_model_title'] = kwargs['parent_model_title']