mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Allow stock API to filter by parts which are not active
This commit is contained in:
parent
393597612e
commit
e3102900b6
@ -410,8 +410,16 @@ class StockList(generics.ListCreateAPIView):
|
|||||||
# Start with all objects
|
# Start with all objects
|
||||||
stock_list = super(StockList, self).get_queryset()
|
stock_list = super(StockList, self).get_queryset()
|
||||||
|
|
||||||
|
# Filter out parts which are not actually "in stock"
|
||||||
stock_list = stock_list.filter(customer=None, belongs_to=None)
|
stock_list = stock_list.filter(customer=None, belongs_to=None)
|
||||||
|
|
||||||
|
# Do we wish to filter by "active parts"
|
||||||
|
active = self.request.query_params.get('active', None)
|
||||||
|
|
||||||
|
if active is not None:
|
||||||
|
active = str2bool(active)
|
||||||
|
stock_list = stock_list.filter(part__active=active)
|
||||||
|
|
||||||
# Does the client wish to filter by the Part ID?
|
# Does the client wish to filter by the Part ID?
|
||||||
part_id = self.request.query_params.get('part', None)
|
part_id = self.request.query_params.get('part', None)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user