mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Hide 'supplier part' options if no part is selected in the form
This commit is contained in:
parent
3a75682878
commit
9dcc23ee4e
@ -1240,7 +1240,7 @@ class StockItemCreate(AjaxCreateView):
|
||||
form.rebuild_layout()
|
||||
|
||||
# Hide the 'part' field (as a valid part is selected)
|
||||
form.fields['part'].widget = HiddenInput()
|
||||
# form.fields['part'].widget = HiddenInput()
|
||||
|
||||
# trackable parts get special consideration
|
||||
if part.trackable:
|
||||
@ -1267,6 +1267,11 @@ class StockItemCreate(AjaxCreateView):
|
||||
# TODO - This does NOT work for some reason? Ref build.views.BuildItemCreate
|
||||
form.fields['supplier_part'].initial = all_parts[0].id
|
||||
|
||||
else:
|
||||
# No Part has been selected!
|
||||
# We must not provide *any* options for SupplierPart
|
||||
form.fields['supplier_part'].queryset = SupplierPart.objects.none()
|
||||
|
||||
# Otherwise if the user has selected a SupplierPart, we know what Part they meant!
|
||||
if form['supplier_part'].value() is not None:
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user