From 2cc0bb1995c56351f4e52fa37cc49c197c47968e Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 4 Jan 2018 10:38:15 -0600 Subject: [PATCH] Tweak product filter for report code name i.e. make it more clear that it leverages the name --- tailbone/views/products.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tailbone/views/products.py b/tailbone/views/products.py index 05757bf9..a8b9b33a 100644 --- a/tailbone/views/products.py +++ b/tailbone/views/products.py @@ -169,7 +169,6 @@ class ProductsView(MasterView): model.Department.uuid == model.Product.department_uuid) g.joiners['subdepartment'] = lambda q: q.outerjoin(model.Subdepartment, model.Subdepartment.uuid == model.Product.subdepartment_uuid) - g.joiners['report_code'] = lambda q: q.outerjoin(model.ReportCode) g.joiners['code'] = lambda q: q.outerjoin(model.ProductCode) g.joiners['vendor'] = join_vendor g.joiners['vendor_any'] = join_vendor_any @@ -193,7 +192,6 @@ class ProductsView(MasterView): g.filters['department'] = g.make_filter('department', model.Department.name, default_active=True, default_verb='contains') g.filters['subdepartment'] = g.make_filter('subdepartment', model.Subdepartment.name) - g.filters['report_code'] = g.make_filter('report_code', model.ReportCode.name) g.filters['code'] = g.make_filter('code', model.ProductCode.code) g.filters['vendor'] = g.make_filter('vendor', model.Vendor.name) g.filters['vendor_any'] = g.make_filter('vendor_any', self.VendorAny.name) @@ -220,6 +218,10 @@ class ProductsView(MasterView): g.set_sorter('current_price', self.CurrentPrice.price) g.set_filter('current_price', self.CurrentPrice.price, label="Current Price") + # report_code_name + g.set_joiner('report_code_name', lambda q: q.outerjoin(model.ReportCode)) + g.set_filter('report_code_name', model.ReportCode.name) + g.set_sort_defaults('upc') if self.print_labels and self.request.has_perm('products.print_labels'):