mirror of
https://github.com/inventree/InvenTree.git
synced 2026-10-05 18:01:14 +00:00
Limit queryset
- Only parts from the supplier - Exclude parts already in the order
This commit is contained in:
1 parent
f4abfc158f
commit
aee1ea9e35
1 file changed
+2
-2
@@ -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
|
||||
|
||||
Reference in new issue
Block a user