mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-20 05:46:34 +00:00
adds depleted stock to index
This commit is contained in:
@ -651,6 +651,15 @@ class PartList(generics.ListCreateAPIView):
|
||||
# Filter items which have an 'in_stock' level higher than 'minimum_stock'
|
||||
queryset = queryset.filter(Q(in_stock__gte=F('minimum_stock')))
|
||||
|
||||
# If we are filtering by 'depleted_stock' status
|
||||
depleted_stock = params.get('depleted_stock', None)
|
||||
|
||||
if depleted_stock is not None:
|
||||
depleted_stock = str2bool(depleted_stock)
|
||||
|
||||
if depleted_stock:
|
||||
queryset = queryset.filter(Q(in_stock=0) & ~Q(stock_item_count=0))
|
||||
|
||||
# Filter by "parts which need stock to complete build"
|
||||
stock_to_build = params.get('stock_to_build', None)
|
||||
|
||||
|
Reference in New Issue
Block a user