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:
|
for key in config:
|
||||||
if key.startswith('include_filter_') and config[key]:
|
if key.startswith('include_filter_') and config[key]:
|
||||||
field = key[15:]
|
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)
|
value = config.get(field)
|
||||||
if value:
|
if value:
|
||||||
|
if field in join_map and field not in joins:
|
||||||
|
query = join_map[field](query)
|
||||||
|
joins.append(field)
|
||||||
fmap = filter_map[field]
|
fmap = filter_map[field]
|
||||||
filt = fmap[config['filter_type_'+field]]
|
filt = fmap[config['filter_type_'+field]]
|
||||||
query = filt(query, value)
|
query = filt(query, value)
|
||||||
|
|
|
@ -73,11 +73,6 @@ class ProductsGrid(SearchableAlchemyGridView):
|
||||||
# q = q.outerjoin(Vendor)
|
# q = q.outerjoin(Vendor)
|
||||||
# return q
|
# return q
|
||||||
|
|
||||||
def join_vendor_any(q):
|
|
||||||
return q.outerjoin(ProductCost,
|
|
||||||
ProductCost.product_uuid == Product.uuid)\
|
|
||||||
.outerjoin(Vendor)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'brand':
|
'brand':
|
||||||
lambda q: q.outerjoin(Brand),
|
lambda q: q.outerjoin(Brand),
|
||||||
|
@ -96,7 +91,7 @@ class ProductsGrid(SearchableAlchemyGridView):
|
||||||
# 'vendor':
|
# 'vendor':
|
||||||
# join_vendor,
|
# join_vendor,
|
||||||
'vendor_any':
|
'vendor_any':
|
||||||
join_vendor_any,
|
lambda q: q.outerjoin(ProductCost, ProductCost.product_uuid == Product.uuid).outerjoin(Vendor),
|
||||||
'code':
|
'code':
|
||||||
lambda q: q.outerjoin(ProductCode),
|
lambda q: q.outerjoin(ProductCode),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue