mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Limit SupplierPart option in Part edit form
- Only allow selection of SupplierPart that match the Part being edited
This commit is contained in:
parent
13756751c3
commit
4e3702384b
@ -169,6 +169,21 @@ class PartEdit(AjaxUpdateView):
|
||||
ajax_form_title = 'Edit Part Properties'
|
||||
context_object_name = 'part'
|
||||
|
||||
def get_form(self):
|
||||
""" Create form for Part editing.
|
||||
Overrides default get_form() method to limit the choices
|
||||
for the 'default_supplier' field to SupplierParts that reference this part
|
||||
"""
|
||||
|
||||
form = super(AjaxUpdateView, self).get_form()
|
||||
|
||||
part = self.get_object()
|
||||
|
||||
form.fields['default_supplier'].queryset = SupplierPart.objects.filter(part=part)
|
||||
|
||||
return form
|
||||
|
||||
|
||||
|
||||
class BomExport(AjaxView):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user