mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Limit queryset
- Only parts from the supplier - Exclude parts already in the order
This commit is contained in:
parent
f4abfc158f
commit
aee1ea9e35
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user