From 5e0d1fe25ac43fd42f3d5e95ec07359bf8db4694 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 26 Oct 2020 18:21:45 +1100 Subject: [PATCH] Allocate "non tracked" parts separately from tracked ones --- InvenTree/build/forms.py | 2 +- InvenTree/build/templates/build/allocate.html | 30 ++++-- .../templates/build/allocation_card.html | 25 +++-- InvenTree/build/views.py | 23 ++-- InvenTree/order/views.py | 2 +- InvenTree/templates/js/build.js | 102 +++++++++++++----- 6 files changed, 128 insertions(+), 56 deletions(-) diff --git a/InvenTree/build/forms.py b/InvenTree/build/forms.py index 1413eddc03..62e5816e1f 100644 --- a/InvenTree/build/forms.py +++ b/InvenTree/build/forms.py @@ -177,4 +177,4 @@ class EditBuildAttachmentForm(HelperForm): 'build', 'attachment', 'comment' - ] + ] diff --git a/InvenTree/build/templates/build/allocate.html b/InvenTree/build/templates/build/allocate.html index 71c627e0e8..c27d8f17de 100644 --- a/InvenTree/build/templates/build/allocate.html +++ b/InvenTree/build/templates/build/allocate.html @@ -25,29 +25,39 @@ InvenTree | Allocate Parts
--> - +

{% trans "Untracked Parts" %}

- {% for item in build.incomplete_outputs %} - {% include "build/allocation_card.html" with item=item complete=False %} - {% endfor %} + {% include "build/allocation_card.html" %}
+{% if build.incomplete_outputs %} +

{% trans "Tracked Build Ouputs" %}

+
+ {% for item in build.incomplete_outputs %} + {% include "build/allocation_card.html" with item=item %} + {% endfor %} +
+{% endif %} {% endblock %} {% block js_ready %} {{ block.super }} - {% for item in build.incomplete_outputs %} + var buildInfo = { + pk: {{ build.pk }}, + quantity: {{ build.quantity }}, + completed: {{ build.completed }}, + part: {{ build.part.pk }}, + }; + loadBuildOutputAllocationTable(buildInfo, null); + + {% for item in build.incomplete_outputs %} // Get the build output as a javascript object inventreeGet('{% url 'api-stock-detail' item.pk %}', {}, { success: function(response) { - loadBuildOutputAllocationTable( - {{ build.pk }}, - {{ build.part.pk }}, - response - ); + loadBuildOutputAllocationTable(buildInfo, response); } } ); diff --git a/InvenTree/build/templates/build/allocation_card.html b/InvenTree/build/templates/build/allocation_card.html index 6e9faceb22..dbf5350999 100644 --- a/InvenTree/build/templates/build/allocation_card.html +++ b/InvenTree/build/templates/build/allocation_card.html @@ -1,33 +1,44 @@ {% load i18n %} +{% load inventree_extras %} -
-