diff --git a/tailbone/views/products.py b/tailbone/views/products.py index 3419ccfe..cc6a47ec 100644 --- a/tailbone/views/products.py +++ b/tailbone/views/products.py @@ -204,6 +204,7 @@ class ProductView(MasterView): def configure_grid(self, g): super(ProductView, self).configure_grid(g) app = self.get_rattail_app() + use_buefy = self.get_use_buefy() def join_vendor(q): return q.outerjoin(self.ProductVendorCost, @@ -239,6 +240,12 @@ class ProductView(MasterView): department_choices = app.cache_model(self.Session(), model.Department, order_by=model.Department.name, normalizer=lambda d: d.name) + department_choices = OrderedDict([('', "(any)")] + + sorted(six.iteritems(department_choices), + key=lambda itm: itm[1])) + if not use_buefy: + department_choices = [tags.Option(name, uuid) + for uuid, name in six.iteritems(department_choices)] g.set_filter('department', model.Department.uuid, value_enum=department_choices, verbs=['equal', 'not_equal', 'is_null', 'is_not_null', 'is_any'],