mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 12:36:45 +00:00
- Available filter also requires "in stock" (cherry picked from commit c0dafe155fbaa872110bc53c5ce190b3fde53ada) Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
parent
970714a76f
commit
5b6d999091
@ -434,7 +434,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…
x
Reference in New Issue
Block a user