Add basic autocomplete support for "quick row" feature

This commit is contained in:
Lance Edgar 2018-07-13 19:12:39 -05:00
parent 68bd3047c4
commit 935a6b2a68
4 changed files with 58 additions and 7 deletions

View file

@ -152,9 +152,9 @@ class BatchMasterView(MasterView):
if kwargs['mobile']:
if self.mobile_rows_creatable:
kwargs.setdefault('add_item_title', "Add Item")
if self.mobile_rows_quickable:
kwargs.setdefault('quick_row_entry_placeholder', "Enter {}".format(
self.rattail_config.product_key_title()))
if self.mobile_rows_quickable:
kwargs.setdefault('quick_row_entry_placeholder', "Enter {}".format(
self.rattail_config.product_key_title()))
if kwargs['execute_enabled']:
url = self.get_action_url('execute', batch)
kwargs['execute_form'] = self.make_execute_form(batch, action_url=url)
@ -490,6 +490,18 @@ class BatchMasterView(MasterView):
return False
return True
def rows_quickable_for(self, batch):
"""
Must return boolean indicating whether the "quick row" feature should
be allowed for the given batch. By default, returns ``False`` if batch
has already been executed or marked complete, and ``True`` otherwise.
"""
if batch.executed:
return False
if batch.complete:
return False
return True
def configure_row_grid(self, g):
super(BatchMasterView, self).configure_row_grid(g)