diff --git a/InvenTree/order/templates/order/purchase_order_detail.html b/InvenTree/order/templates/order/purchase_order_detail.html
index 5debf92c5b..d988f20739 100644
--- a/InvenTree/order/templates/order/purchase_order_detail.html
+++ b/InvenTree/order/templates/order/purchase_order_detail.html
@@ -108,9 +108,7 @@ InvenTree | {{ order }}
Received |
{% endif %}
Note |
- {% if order.status == OrderStatus.PENDING %}
|
- {% endif %}
@@ -137,18 +135,23 @@ InvenTree | {{ order }}
{{ line.notes }}
|
- {% if order.status == OrderStatus.PENDING %}
+ {% if order.status == OrderStatus.PENDING %}
+ {% endif %}
+ {% if order.status == OrderStatus.PLACED and line.received < line.quantity %}
+
+ {% endif %}
|
- {% endif %}
{% endfor %}
@@ -187,6 +190,20 @@ $("#cancel-order").click(function() {
});
});
+$("#po-lines-table").on('click', ".line-receive", function() {
+
+ var button = $(this);
+
+ console.log('clicked! ' + button.attr('pk'));
+
+ launchModalForm("{% url 'purchase-order-receive' order.id %}", {
+ reload: true,
+ data: {
+ line: button.attr('pk')
+ }
+ });
+});
+
$("#receive-order").click(function() {
launchModalForm("{% url 'purchase-order-receive' order.id %}", {
reload: true,
diff --git a/InvenTree/order/views.py b/InvenTree/order/views.py
index d2300f2527..5ae955b3c8 100644
--- a/InvenTree/order/views.py
+++ b/InvenTree/order/views.py
@@ -230,6 +230,31 @@ class PurchaseOrderReceive(AjaxUpdateView):
return ctx
+ def get_lines(self):
+ """
+ Extract particular line items from the request,
+ or default to *all* pending line items if none are provided
+ """
+
+ lines = None
+
+ if 'line' in self.request.GET:
+ line_id = self.request.GET.get('line')
+
+ try:
+ lines = PurchaseOrderLineItem.objects.filter(pk=line_id)
+ except (PurchaseOrderLineItem.DoesNotExist, ValueError):
+ pass
+
+ # TODO - Option to pass multiple lines?
+
+ # No lines specified - default selection
+ if lines is None:
+ lines = self.order.pending_line_items()
+
+ return lines
+
+
def get(self, request, *args, **kwargs):
""" Respond to a GET request. Determines which parts are outstanding,
and presents a list of these parts to the user.
@@ -238,7 +263,7 @@ class PurchaseOrderReceive(AjaxUpdateView):
self.request = request
self.order = get_object_or_404(PurchaseOrder, pk=self.kwargs['pk'])
- self.lines = self.order.pending_line_items()
+ self.lines = self.get_lines()
for line in self.lines:
# Pre-fill the remaining quantity