Add category name filter for products grid
This commit is contained in:
parent
ecf7acc800
commit
37a21d93a1
|
@ -207,7 +207,6 @@ class ProductsView(MasterView):
|
|||
ProductCostCodeAny.product_uuid == model.Product.uuid)
|
||||
|
||||
g.joiners['brand'] = lambda q: q.outerjoin(model.Brand)
|
||||
g.joiners['family'] = lambda q: q.outerjoin(model.Family)
|
||||
g.joiners['department'] = lambda q: q.outerjoin(model.Department,
|
||||
model.Department.uuid == model.Product.department_uuid)
|
||||
g.joiners['subdepartment'] = lambda q: q.outerjoin(model.Subdepartment,
|
||||
|
@ -231,7 +230,6 @@ class ProductsView(MasterView):
|
|||
g.filters['description'].default_verb = 'contains'
|
||||
g.filters['brand'] = g.make_filter('brand', model.Brand.name,
|
||||
default_active=True, default_verb='contains')
|
||||
g.filters['family'] = g.make_filter('family', model.Family.name)
|
||||
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)
|
||||
|
@ -242,6 +240,14 @@ class ProductsView(MasterView):
|
|||
g.filters['vendor_code'] = g.make_filter('vendor_code', ProductCostCode.code)
|
||||
g.filters['vendor_code_any'] = g.make_filter('vendor_code_any', ProductCostCodeAny.code)
|
||||
|
||||
# category
|
||||
g.set_joiner('category', lambda q: q.outerjoin(model.Category))
|
||||
g.set_filter('category', model.Category.name)
|
||||
|
||||
# family
|
||||
g.set_joiner('family', lambda q: q.outerjoin(model.Family))
|
||||
g.set_filter('family', model.Family.name)
|
||||
|
||||
g.set_label('regular_price', "Reg. Price")
|
||||
g.set_joiner('regular_price', lambda q: q.outerjoin(
|
||||
self.RegularPrice, self.RegularPrice.uuid == model.Product.regular_price_uuid))
|
||||
|
|
Loading…
Reference in a new issue