From aee1ea9e35ce6b0fb382182f6c97ddb535d5520e Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Wed, 5 Jun 2019 21:13:08 +1000 Subject: [PATCH] Limit queryset - Only parts from the supplier - Exclude parts already in the order --- InvenTree/order/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/InvenTree/order/views.py b/InvenTree/order/views.py index ac84ee1f4f..d7d08988bd 100644 --- a/InvenTree/order/views.py +++ b/InvenTree/order/views.py @@ -71,11 +71,11 @@ class POLineItemCreate(AjaxCreateView): # Only allow parts from the selected supplier query = query.filter(supplier=order.supplier.id) - print('limiting queryset') + # Remove parts that are already in the order + query = query.exclude(id__in=[line.part.id for line in order.lines.all()]) form.fields['part'].queryset = query except PurchaseOrder.DoesNotExist: - print('error') pass return form