mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-01 13:06:45 +00:00
Limit SupplierPart choices in EditStockItem view
This commit is contained in:
parent
c22494b7e9
commit
abb8930702
@ -115,6 +115,22 @@ class StockItemEdit(AjaxUpdateView):
|
|||||||
ajax_template_name = 'modal_form.html'
|
ajax_template_name = 'modal_form.html'
|
||||||
ajax_form_title = 'Edit Stock Item'
|
ajax_form_title = 'Edit Stock Item'
|
||||||
|
|
||||||
|
def get_form(self):
|
||||||
|
""" Get form for StockItem editing.
|
||||||
|
|
||||||
|
Limit the choices for supplier_part
|
||||||
|
"""
|
||||||
|
|
||||||
|
form = super(AjaxUpdateView, self).get_form()
|
||||||
|
|
||||||
|
item = self.get_object()
|
||||||
|
|
||||||
|
query = form.fields['supplier_part'].queryset
|
||||||
|
query = query.filter(part=item.part.id)
|
||||||
|
form.fields['supplier_part'].queryset = query
|
||||||
|
|
||||||
|
return form
|
||||||
|
|
||||||
|
|
||||||
class StockLocationCreate(AjaxCreateView):
|
class StockLocationCreate(AjaxCreateView):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user