From 4a381c747472dc3d7bc6563780ea313ee2b7746c Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 16 Mar 2022 23:28:30 +1100 Subject: [PATCH] Part allocation query improvements --- InvenTree/part/models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index 2adadeb8ce..fad0f12e28 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -1353,6 +1353,12 @@ class Part(MPTTModel): line__order__status__in=SalesOrderStatus.OPEN, shipment__shipment_date=None, ) + elif pending is False: + # Look only for 'closed' orders or orders which have shipped + queryset = queryset.exclude( + line__order__status__in=SalesOrderStatus.OPEN, + shipment__shipment_date=None, + ) return queryset