Fixed grid join map bug.
This commit is contained in:
parent
685b391dd2
commit
23e08d0bb0
|
@ -274,11 +274,11 @@ def filter_query(query, config, filter_map, join_map):
|
|||
for key in config:
|
||||
if key.startswith('include_filter_') and config[key]:
|
||||
field = key[15:]
|
||||
if field in join_map and field not in joins:
|
||||
query = join_map[field](query)
|
||||
joins.append(field)
|
||||
value = config.get(field)
|
||||
if value:
|
||||
if field in join_map and field not in joins:
|
||||
query = join_map[field](query)
|
||||
joins.append(field)
|
||||
fmap = filter_map[field]
|
||||
filt = fmap[config['filter_type_'+field]]
|
||||
query = filt(query, value)
|
||||
|
|
|
@ -73,11 +73,6 @@ class ProductsGrid(SearchableAlchemyGridView):
|
|||
# q = q.outerjoin(Vendor)
|
||||
# return q
|
||||
|
||||
def join_vendor_any(q):
|
||||
return q.outerjoin(ProductCost,
|
||||
ProductCost.product_uuid == Product.uuid)\
|
||||
.outerjoin(Vendor)
|
||||
|
||||
return {
|
||||
'brand':
|
||||
lambda q: q.outerjoin(Brand),
|
||||
|
@ -96,7 +91,7 @@ class ProductsGrid(SearchableAlchemyGridView):
|
|||
# 'vendor':
|
||||
# join_vendor,
|
||||
'vendor_any':
|
||||
join_vendor_any,
|
||||
lambda q: q.outerjoin(ProductCost, ProductCost.product_uuid == Product.uuid).outerjoin(Vendor),
|
||||
'code':
|
||||
lambda q: q.outerjoin(ProductCode),
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue