diff --git a/tailbone/views/batch/vendorcatalog.py b/tailbone/views/batch/vendorcatalog.py index 86d8404b..3661dc25 100644 --- a/tailbone/views/batch/vendorcatalog.py +++ b/tailbone/views/batch/vendorcatalog.py @@ -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')