diff --git a/InvenTree/build/templates/build/allocate.html b/InvenTree/build/templates/build/allocate.html index 8ab194d129..1ed791a8ab 100644 --- a/InvenTree/build/templates/build/allocate.html +++ b/InvenTree/build/templates/build/allocate.html @@ -10,7 +10,25 @@
- + + + + + + + + +{% for item in build.part.bom_items.all %} + + + + + + + + +{% endfor %} +
PartSourceQuantity
{{ item.sub_part.name }}
Select...
{% endblock %} \ No newline at end of file diff --git a/InvenTree/stock/api.py b/InvenTree/stock/api.py index f92b64fa13..99b22d11e3 100644 --- a/InvenTree/stock/api.py +++ b/InvenTree/stock/api.py @@ -75,6 +75,7 @@ class StockList(generics.ListCreateAPIView): 'location', 'supplier_part', 'customer', + 'belongs_to', 'status', ] diff --git a/InvenTree/stock/templates/stock/item.html b/InvenTree/stock/templates/stock/item.html index 27fff0ef23..18ed7c507e 100644 --- a/InvenTree/stock/templates/stock/item.html +++ b/InvenTree/stock/templates/stock/item.html @@ -95,6 +95,9 @@
+{% if item.in_stock %} + +{% endif %}
@@ -116,6 +119,16 @@ }); }); + {% if item.in_stock %} + $("#move-item").click(function() { + launchModalForm("#modal-form", + "{% url 'stock-item-move' item.id %}", + { + reload: true, + }); + }); + {% endif %} + $("#delete-item").click(function () { launchDeleteForm("#modal-delete", "{% url 'stock-item-delete' item.id %}", diff --git a/InvenTree/stock/urls.py b/InvenTree/stock/urls.py index 6ca31ca967..2f4d0c1c67 100644 --- a/InvenTree/stock/urls.py +++ b/InvenTree/stock/urls.py @@ -14,7 +14,7 @@ stock_location_detail_urls = [ stock_item_detail_urls = [ url(r'^edit/?', views.StockItemEdit.as_view(), name='stock-item-edit'), url(r'^delete/?', views.StockItemDelete.as_view(), name='stock-item-delete'), - + url(r'^move/?', views.StockItemMove.as_view(), name='stock-item-move'), url('^.*$', views.StockItemDetail.as_view(), name='stock-item-detail'), ] diff --git a/InvenTree/stock/views.py b/InvenTree/stock/views.py index de2f923f1d..c3bcfe4a82 100644 --- a/InvenTree/stock/views.py +++ b/InvenTree/stock/views.py @@ -11,8 +11,9 @@ from part.models import Part from .models import StockItem, StockLocation from .forms import EditStockLocationForm +from .forms import CreateStockItemForm from .forms import EditStockItemForm - +from .forms import MoveStockItemForm class StockIndex(ListView): model = StockItem @@ -84,7 +85,7 @@ class StockLocationCreate(AjaxCreateView): class StockItemCreate(AjaxCreateView): model = StockItem - form_class = EditStockItemForm + form_class = CreateStockItemForm template_name = 'stock/item_create.html' context_object_name = 'item' ajax_template_name = 'modal_form.html' @@ -123,3 +124,14 @@ class StockItemDelete(AjaxDeleteView): template_name = 'stock/item_delete.html' context_object_name = 'item' ajax_form_title = 'Delete Stock Item' + + +class StockItemMove(AjaxUpdateView): + model = StockItem + template_name = 'modal_form.html' + context_object_name = 'item' + ajax_form_title = 'Move Stock Item' + ajax_submit_text = 'Move' + form_class = MoveStockItemForm + +