mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
StockItem LIST API can now be filtered by StocKItem status
This commit is contained in:
parent
23aebab6d0
commit
0f4d60dceb
@ -258,6 +258,7 @@ class StockList(generics.ListCreateAPIView):
|
||||
- category: Filter by parts belonging to a certain category
|
||||
- supplier: Filter by supplier
|
||||
- ancestor: Filter by an 'ancestor' StockItem
|
||||
- status: Filter by the StockItem status
|
||||
"""
|
||||
|
||||
queryset = StockItem.objects.all()
|
||||
@ -391,6 +392,12 @@ class StockList(generics.ListCreateAPIView):
|
||||
except (ValueError, PartCategory.DoesNotExist):
|
||||
pass
|
||||
|
||||
# Filter by StockItem status
|
||||
status = self.request.query_params.get('status', None)
|
||||
|
||||
if status:
|
||||
stock_list = stock_list.filter(status=status)
|
||||
|
||||
# Filter by supplier_part ID
|
||||
supplier_part_id = self.request.query_params.get('supplier_part', None)
|
||||
|
||||
@ -430,8 +437,7 @@ class StockList(generics.ListCreateAPIView):
|
||||
'supplier_part',
|
||||
'customer',
|
||||
'belongs_to',
|
||||
'build',
|
||||
# 'status' TODO - There are some issues filtering based on an enumeration field
|
||||
'build'
|
||||
]
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user