From 0841c628e0ba8626aad14882e76753ede63b0c8c Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 28 Apr 2022 17:27:09 +1000 Subject: [PATCH] Adds ability to filter build items by "tracked" flag --- InvenTree/build/api.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/InvenTree/build/api.py b/InvenTree/build/api.py index 33f3f4ab36..2e2fb53510 100644 --- a/InvenTree/build/api.py +++ b/InvenTree/build/api.py @@ -442,6 +442,18 @@ class BuildItemList(generics.ListCreateAPIView): if part_pk: queryset = queryset.filter(stock_item__part=part_pk) + # Filter by "tracked" status + # Tracked means that the item is "installed" into a build output (stock item) + tracked = params.get('tracked', None) + + if tracked is not None: + tracked = str2bool(tracked) + + if tracked: + queryset = queryset.exclude(install_into=None) + else: + queryset = queryest.filter(install_into=None) + # Filter by output target output = params.get('output', None)