Changed vendor filter in product search to find "any vendor".
I.e. the current filter is ''not'' restricted to the preferred vendor only. Probably should still add one (back) for preferred only as well; hence the commented code.
This commit is contained in:
parent
88adfe5d85
commit
047c35ab75
|
@ -61,15 +61,21 @@ class ProductsGrid(SearchableAlchemyGridView):
|
||||||
|
|
||||||
def join_map(self):
|
def join_map(self):
|
||||||
|
|
||||||
def join_vendor(q):
|
# def join_vendor(q):
|
||||||
q = q.outerjoin(
|
# q = q.outerjoin(
|
||||||
ProductCost,
|
# ProductCost,
|
||||||
and_(
|
# ProductCost.product_uuid == Product.uuid,
|
||||||
ProductCost.product_uuid == Product.uuid,
|
# and_(
|
||||||
ProductCost.preference == 1,
|
# ProductCost.product_uuid == Product.uuid,
|
||||||
))
|
# ProductCost.preference == 1,
|
||||||
q = q.outerjoin(Vendor)
|
# ))
|
||||||
return q
|
# q = q.outerjoin(Vendor)
|
||||||
|
# return q
|
||||||
|
|
||||||
|
def join_vendor_any(q):
|
||||||
|
return q.outerjoin(ProductCost,
|
||||||
|
ProductCost.product_uuid == Product.uuid)\
|
||||||
|
.outerjoin(Vendor)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'brand':
|
'brand':
|
||||||
|
@ -86,8 +92,10 @@ class ProductsGrid(SearchableAlchemyGridView):
|
||||||
'current_price':
|
'current_price':
|
||||||
lambda q: q.outerjoin(ProductPrice,
|
lambda q: q.outerjoin(ProductPrice,
|
||||||
ProductPrice.uuid == Product.current_price_uuid),
|
ProductPrice.uuid == Product.current_price_uuid),
|
||||||
'vendor':
|
# 'vendor':
|
||||||
join_vendor,
|
# join_vendor,
|
||||||
|
'vendor_any':
|
||||||
|
join_vendor_any,
|
||||||
'code':
|
'code':
|
||||||
lambda q: q.outerjoin(ProductCode),
|
lambda q: q.outerjoin(ProductCode),
|
||||||
}
|
}
|
||||||
|
@ -122,7 +130,8 @@ class ProductsGrid(SearchableAlchemyGridView):
|
||||||
brand=self.filter_ilike(Brand.name),
|
brand=self.filter_ilike(Brand.name),
|
||||||
department=self.filter_ilike(Department.name),
|
department=self.filter_ilike(Department.name),
|
||||||
subdepartment=self.filter_ilike(Subdepartment.name),
|
subdepartment=self.filter_ilike(Subdepartment.name),
|
||||||
vendor=self.filter_ilike(Vendor.name),
|
# vendor=self.filter_ilike(Vendor.name),
|
||||||
|
vendor_any=self.filter_ilike(Vendor.name),
|
||||||
code=self.filter_ilike(ProductCode.code))
|
code=self.filter_ilike(ProductCode.code))
|
||||||
|
|
||||||
def filter_config(self):
|
def filter_config(self):
|
||||||
|
@ -136,8 +145,9 @@ class ProductsGrid(SearchableAlchemyGridView):
|
||||||
filter_type_description='lk',
|
filter_type_description='lk',
|
||||||
include_filter_department=True,
|
include_filter_department=True,
|
||||||
filter_type_department='lk',
|
filter_type_department='lk',
|
||||||
include_filter_vendor=True,
|
include_filter_vendor_any=True,
|
||||||
filter_type_vendor='lk')
|
filter_label_vendor_any="Vendor (any)",
|
||||||
|
filter_type_vendor_any='lk')
|
||||||
|
|
||||||
def sort_map(self):
|
def sort_map(self):
|
||||||
return self.make_sort_map(
|
return self.make_sort_map(
|
||||||
|
@ -171,7 +181,7 @@ class ProductsGrid(SearchableAlchemyGridView):
|
||||||
g.description,
|
g.description,
|
||||||
g.size,
|
g.size,
|
||||||
g.subdepartment,
|
g.subdepartment,
|
||||||
g.vendor,
|
g.vendor.label("Pref. Vendor"),
|
||||||
g.regular_price.label("Reg. Price"),
|
g.regular_price.label("Reg. Price"),
|
||||||
g.current_price.label("Cur. Price"),
|
g.current_price.label("Cur. Price"),
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue