From 9fef4c2601a536a0e62961419e895c728b27bebc Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 3 Nov 2021 16:47:55 -0500 Subject: [PATCH] Fix the Department filter for Products grid, for jquery themes ugh jquery --- tailbone/views/products.py | 7 +++++++ 1 file changed, 7 insertions(+) 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'],