+ {% if tracked_items %}
+ {% endif %}
+ {% if tracked_items %}
+ {% endif %}
{{ item.part.full_name }}
{% if item.serial %}
- # {{ item.serial }}
+ {% trans "Serial Number" %}: {{ item.serial }}
{% else %}
- {% decimal item.quantity %}
+ {% trans "Quantity" %}: {% decimal item.quantity %}
{% endif %}
+ {% if tracked_items %}
+ {% endif %}
+ {% if tracked_items %}
+ {% endif %}
diff --git a/InvenTree/build/templates/build/build_output.html b/InvenTree/build/templates/build/build_output.html
index 9a077524d4..00d7c5d5d2 100644
--- a/InvenTree/build/templates/build/build_output.html
+++ b/InvenTree/build/templates/build/build_output.html
@@ -6,19 +6,68 @@
{% include "build/navbar.html" with tab='output' %}
{% endblock %}
-{% block heading %}
-{% trans "Build Outputs" %}
-{% endblock %}
+{% block content_panels %}
-{% block details %}
+{% if not build.is_complete %}
+
+
+
+ {% trans "Incomplete Build Outputs" %}
+
+
-{% include "stock_table.html" with read_only=True %}
+
+
+ {% if build.active %}
+
+ {% trans "Create New Output" %}
+
+ {% endif %}
+
+
+ {% if build.incomplete_outputs %}
+
+ {% for item in build.incomplete_outputs %}
+ {% include "build/allocation_card.html" with item=item tracked_items=build.has_tracked_bom_items %}
+ {% endfor %}
+
+ {% else %}
+
+ {% trans "Create a new build output" %}
+ {% trans "No incomplete build outputs remain." %}
+ {% trans "Create a new build output using the button above" %}
+
+ {% endif %}
+
+
+
+{% endif %}
+
+
+
+
+ {% trans "Completed Build Outputs" %}
+
+
+
+
+ {% include "stock_table.html" with read_only=True %}
+
+
{% endblock %}
{% block js_ready %}
{{ block.super }}
+$('#btn-create-output').click(function() {
+ launchModalForm('{% url "build-output-create" build.id %}',
+ {
+ reload: true,
+ }
+ );
+});
+
loadStockTable($("#stock-table"), {
params: {
location_detail: true,
@@ -32,4 +81,23 @@ loadStockTable($("#stock-table"), {
url: "{% url 'api-stock-list' %}",
});
+var buildInfo = {
+ pk: {{ build.pk }},
+ quantity: {{ build.quantity }},
+ completed: {{ build.completed }},
+ part: {{ build.part.pk }},
+};
+
+{% 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(buildInfo, response);
+ }
+ }
+);
+{% endfor %}
+
+
{% endblock %}
\ No newline at end of file
diff --git a/InvenTree/build/templates/build/navbar.html b/InvenTree/build/templates/build/navbar.html
index 383f3c843f..00f8172bc5 100644
--- a/InvenTree/build/templates/build/navbar.html
+++ b/InvenTree/build/templates/build/navbar.html
@@ -17,13 +17,7 @@
{% if build.active %}
-
-
-
- {% trans "Required Parts" %}
-
-
-
+
diff --git a/InvenTree/build/templates/build/parts.html b/InvenTree/build/templates/build/parts.html
deleted file mode 100644
index f24d82f20d..0000000000
--- a/InvenTree/build/templates/build/parts.html
+++ /dev/null
@@ -1,30 +0,0 @@
-{% extends "build/build_base.html" %}
-{% load static %}
-{% load i18n %}
-{% load status_codes %}
-
-{% block menubar %}
-{% include "build/navbar.html" with tab='parts' %}
-{% endblock %}
-
-{% block heading %}
-{% trans "Required Parts" %}
-{% endblock %}
-
-{% block details %}
-
-
-{% endblock %}
-
-{% block js_ready %}
-
-{{ block.super }}
-
-loadBuildPartsTable($('#parts-table'), {
- part: {{ build.part.pk }},
- build: {{ build.pk }},
- build_quantity: {{ build.quantity }},
- build_remaining: {{ build.remaining }},
-});
-
-{% endblock %}
\ No newline at end of file
diff --git a/InvenTree/build/urls.py b/InvenTree/build/urls.py
index 877b368817..99b6b72818 100644
--- a/InvenTree/build/urls.py
+++ b/InvenTree/build/urls.py
@@ -21,7 +21,6 @@ build_detail_urls = [
url(r'^notes/', views.BuildNotes.as_view(), name='build-notes'),
url(r'^children/', views.BuildDetail.as_view(template_name='build/build_children.html'), name='build-children'),
- url(r'^parts/', views.BuildDetail.as_view(template_name='build/parts.html'), name='build-parts'),
url(r'^attachments/', views.BuildDetail.as_view(template_name='build/attachments.html'), name='build-attachments'),
url(r'^output/', views.BuildDetail.as_view(template_name='build/build_output.html'), name='build-output'),
diff --git a/InvenTree/build/views.py b/InvenTree/build/views.py
index c467d374ba..8f5141812f 100644
--- a/InvenTree/build/views.py
+++ b/InvenTree/build/views.py
@@ -620,10 +620,12 @@ class BuildAllocate(InvenTreeRoleMixin, DetailView):
build = self.get_object()
part = build.part
- bom_items = part.bom_items
+ bom_items = build.bom_items
context['part'] = part
context['bom_items'] = bom_items
+ context['has_tracked_bom_items'] = build.has_tracked_bom_items()
+ context['has_untracked_bom_items'] = build.has_untracked_bom_items()
context['BuildStatus'] = BuildStatus
context['bom_price'] = build.part.get_price_info(build.quantity, buy=False)
diff --git a/InvenTree/templates/js/build.js b/InvenTree/templates/js/build.js
index cdfd6756aa..16425fd9e2 100644
--- a/InvenTree/templates/js/build.js
+++ b/InvenTree/templates/js/build.js
@@ -32,7 +32,7 @@ function newBuildOrder(options={}) {
}
-function makeBuildOutputActionButtons(output, buildInfo) {
+function makeBuildOutputActionButtons(output, buildInfo, lines) {
/* Generate action buttons for a build output.
*/
@@ -56,18 +56,20 @@ function makeBuildOutputActionButtons(output, buildInfo) {
var html = ``;
// "Auto" allocation only works for untracked stock items
- if (!output) {
+ if (!output && lines > 0) {
html += makeIconButton(
'fa-magic icon-blue', 'button-output-auto', outputId,
'{% trans "Auto-allocate stock items to this output" %}',
);
}
- // Add a button to "cancel" the particular build output (unallocate)
- html += makeIconButton(
- 'fa-minus-circle icon-red', 'button-output-unallocate', outputId,
- '{% trans "Unallocate stock from build output" %}',
- );
+ if (lines > 0) {
+ // Add a button to "cancel" the particular build output (unallocate)
+ html += makeIconButton(
+ 'fa-minus-circle icon-red', 'button-output-unallocate', outputId,
+ '{% trans "Unallocate stock from build output" %}',
+ );
+ }
if (output) {
@@ -407,16 +409,21 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
// Update the total progress for this build output
var buildProgress = $(`#allocation-panel-${outputId}`).find($(`#output-progress-${outputId}`));
- var progress = makeProgressBar(
- allocatedLines,
- totalLines
- );
+ if (totalLines > 0) {
- buildProgress.html(progress);
+ var progress = makeProgressBar(
+ allocatedLines,
+ totalLines
+ );
+
+ buildProgress.html(progress);
+ } else {
+ buildProgress.html('');
+ }
// Update the available actions for this build output
- makeBuildOutputActionButtons(output, buildInfo);
+ makeBuildOutputActionButtons(output, buildInfo, totalLines);
}
}
);
@@ -640,6 +647,9 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
},
]
});
+
+ // Initialize the action buttons
+ makeBuildOutputActionButtons(output, buildInfo, 0);
}
@@ -694,7 +704,7 @@ function loadBuildTable(table, options) {
field: 'reference',
title: '{% trans "Build" %}',
sortable: true,
- switchable: false,
+ switchable: true,
formatter: function(value, row, index, field) {
var prefix = "{% settings_value 'BUILDORDER_REFERENCE_PREFIX' %}";
@@ -715,6 +725,7 @@ function loadBuildTable(table, options) {
{
field: 'title',
title: '{% trans "Description" %}',
+ switchable: true,
},
{
field: 'part',
diff --git a/InvenTree/templates/two_column.html b/InvenTree/templates/two_column.html
index 725e369931..35f084276a 100644
--- a/InvenTree/templates/two_column.html
+++ b/InvenTree/templates/two_column.html
@@ -32,6 +32,7 @@