mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix for 'available' filter (#4952)
- Available filter also requires "in stock"
This commit is contained in:
parent
1df97a7607
commit
c0dafe155f
@ -444,7 +444,8 @@ class StockFilter(rest_filters.FilterSet):
|
||||
"""
|
||||
if str2bool(value):
|
||||
# The 'quantity' field is greater than the calculated 'allocated' field
|
||||
return queryset.filter(Q(quantity__gt=F('allocated')))
|
||||
# Note that the item must also be "in stock"
|
||||
return queryset.filter(StockItem.IN_STOCK_FILTER).filter(Q(quantity__gt=F('allocated')))
|
||||
else:
|
||||
# The 'quantity' field is less than (or equal to) the calculated 'allocated' field
|
||||
return queryset.filter(Q(quantity__lte=F('allocated')))
|
||||
|
Loading…
Reference in New Issue
Block a user