diff --git a/InvenTree/order/templates/order/purchase_order_detail.html b/InvenTree/order/templates/order/purchase_order_detail.html index 1eee598fa8..f663df629e 100644 --- a/InvenTree/order/templates/order/purchase_order_detail.html +++ b/InvenTree/order/templates/order/purchase_order_detail.html @@ -63,6 +63,8 @@ InvenTree | {{ order }} {% if order.status == OrderStatus.PENDING and order.lines.count > 0 %} + {% elif order.status == OrderStatus.PLACED %} + {% endif %} @@ -159,6 +161,12 @@ $("#edit-order").click(function() { ); }); +$("#receive-order").click(function() { + launchModalForm("{% url 'purchase-order-receive' order.id %}", { + reload: true, + }); +}); + $("#export-order").click(function() { location.href = "{% url 'purchase-order-export' order.id %}"; }); diff --git a/InvenTree/order/templates/order/receive_parts.html b/InvenTree/order/templates/order/receive_parts.html new file mode 100644 index 0000000000..c81a016fd7 --- /dev/null +++ b/InvenTree/order/templates/order/receive_parts.html @@ -0,0 +1,10 @@ +{% extends "modal_form.html" %} + +{% block form %} + +
+ +{% endblock %} \ No newline at end of file diff --git a/InvenTree/order/urls.py b/InvenTree/order/urls.py index 695628bad0..38687342c2 100644 --- a/InvenTree/order/urls.py +++ b/InvenTree/order/urls.py @@ -13,6 +13,7 @@ purchase_order_detail_urls = [ url(r'^edit/?', views.PurchaseOrderEdit.as_view(), name='purchase-order-edit'), url(r'^issue/?', views.PurchaseOrderIssue.as_view(), name='purchase-order-issue'), + url(r'^receive/?', views.PurchaseOrderReceive.as_view(), name='purchase-order-receive'), url(r'^export/?', views.PurchaseOrderExport.as_view(), name='purchase-order-export'), diff --git a/InvenTree/order/views.py b/InvenTree/order/views.py index 578021b2cb..0281564474 100644 --- a/InvenTree/order/views.py +++ b/InvenTree/order/views.py @@ -165,6 +165,34 @@ class PurchaseOrderExport(AjaxView): return DownloadFile(filedata, filename) +class PurchaseOrderReceive(AjaxView): + """ View for receiving parts which are outstanding against a PurchaseOrder. + + Any parts which are outstanding are listed. + If all parts are marked as received, the order is closed out. + + """ + + ajax_form_title = "Receive Parts" + ajax_template_name = "order/receive_parts.html" + + def get_context_data(self): + + ctx = { + 'order': self.order, + } + + return ctx + + def get(self, request, *args, **kwargs): + + self.request = request + self.order = get_object_or_404(PurchaseOrder, pk=self.kwargs['pk']) + + return self.renderJsonResponse(request) + + + class OrderParts(AjaxView): """ View for adding various SupplierPart items to a Purchase Order.