Make all batches support mobile by default
with default pending/etc. filter also
This commit is contained in:
parent
48f5da4511
commit
60104f05c7
6 changed files with 71 additions and 70 deletions
|
@ -43,32 +43,6 @@ from tailbone import forms, newgrids as grids
|
|||
from tailbone.views.purchasing import PurchasingBatchView
|
||||
|
||||
|
||||
class MobileBatchStatusFilter(grids.filters.MobileFilter):
|
||||
|
||||
value_choices = ['pending', 'complete', 'executed', 'all']
|
||||
|
||||
def filter_equal(self, query, value):
|
||||
|
||||
if value == 'pending':
|
||||
return query.filter(model.PurchaseBatch.executed == None)\
|
||||
.filter(sa.or_(
|
||||
model.PurchaseBatch.complete == None,
|
||||
model.PurchaseBatch.complete == False))
|
||||
|
||||
if value == 'complete':
|
||||
return query.filter(model.PurchaseBatch.executed == None)\
|
||||
.filter(model.PurchaseBatch.complete == True)
|
||||
|
||||
if value == 'executed':
|
||||
return query.filter(model.PurchaseBatch.executed != None)
|
||||
|
||||
return query
|
||||
|
||||
def iter_choices(self):
|
||||
for value in self.value_choices:
|
||||
yield value, prettify(value)
|
||||
|
||||
|
||||
class MobileItemStatusFilter(grids.filters.MobileFilter):
|
||||
|
||||
value_choices = ['incomplete', 'unexpected', 'damaged', 'expired', 'all']
|
||||
|
@ -116,9 +90,7 @@ class ReceivingBatchView(PurchasingBatchView):
|
|||
model_title_plural = "Receiving Batches"
|
||||
creatable = False
|
||||
rows_deletable = False
|
||||
supports_mobile = True
|
||||
mobile_creatable = True
|
||||
mobile_filterable = True
|
||||
mobile_rows_filterable = True
|
||||
mobile_rows_viewable = True
|
||||
|
||||
|
@ -126,14 +98,6 @@ class ReceivingBatchView(PurchasingBatchView):
|
|||
def batch_mode(self):
|
||||
return self.enum.PURCHASE_BATCH_MODE_RECEIVING
|
||||
|
||||
def make_mobile_filters(self):
|
||||
"""
|
||||
Returns a set of filters for the mobile grid.
|
||||
"""
|
||||
filters = grids.filters.GridFilterSet()
|
||||
filters['status'] = MobileBatchStatusFilter('status', default_value='pending')
|
||||
return filters
|
||||
|
||||
def make_mobile_row_filters(self):
|
||||
"""
|
||||
Returns a set of filters for the mobile row grid.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue