Cleanup grid filters for vendor catalog batches
This commit is contained in:
parent
a9e64e931e
commit
0a42ec77b2
|
@ -148,10 +148,33 @@ class VendorCatalogView(FileBatchMasterView):
|
|||
|
||||
def configure_grid(self, g):
|
||||
super(VendorCatalogView, self).configure_grid(g)
|
||||
g.joiners['vendor'] = lambda q: q.join(model.Vendor)
|
||||
g.filters['vendor'] = g.make_filter('vendor', model.Vendor.name,
|
||||
default_active=True, default_verb='contains')
|
||||
g.sorters['vendor'] = g.make_sorter(model.Vendor.name)
|
||||
model = self.model
|
||||
|
||||
# nb. this batch has vendor_id and vendor_name fields, but in
|
||||
# practice they aren't used much and normally just the vendor
|
||||
# proper is set. so we remove simple filters and add the
|
||||
# custom one for (referenced) vendor name
|
||||
g.remove_filter('vendor_id')
|
||||
g.remove_filter('vendor_name')
|
||||
g.set_joiner('vendor', lambda q: q.join(model.Vendor))
|
||||
g.set_filter('vendor', model.Vendor.name,
|
||||
default_active=True,
|
||||
default_verb='contains')
|
||||
# and this is the same thing we are showing as grid column
|
||||
g.set_sorter('vendor', model.Vendor.name)
|
||||
|
||||
# preferred filters
|
||||
g.set_filters_sequence([
|
||||
'id',
|
||||
'vendor',
|
||||
'description',
|
||||
'executed',
|
||||
'created',
|
||||
'filename',
|
||||
'future',
|
||||
'effective',
|
||||
'notes',
|
||||
])
|
||||
|
||||
g.set_link('vendor')
|
||||
g.set_link('filename')
|
||||
|
|
Loading…
Reference in a new issue