From 2a90cb40cc99a45ad9d9389be3e22a5596a4c17e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 16:03:26 +1000 Subject: [PATCH] Trackable build part fix (#7196) (#7197) * Build Order Page fix: - Do not request test information for non trackable parts * Typo fix (cherry picked from commit b7da959dbde18f05aa34da9e38c38303d0603674) Co-authored-by: Oliver --- InvenTree/build/templates/build/detail.html | 1 + InvenTree/templates/js/translated/build.js | 51 ++++++++++----------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/InvenTree/build/templates/build/detail.html b/InvenTree/build/templates/build/detail.html index 3d2e5d4e964f..a33c9c978118 100644 --- a/InvenTree/build/templates/build/detail.html +++ b/InvenTree/build/templates/build/detail.html @@ -366,6 +366,7 @@

{% trans "Build Notes" %}

source_location: {{ build.take_from.pk }}, {% endif %} tracked_parts: true, + trackable: {% js_bool build.part.trackable %} }; loadBuildOutputTable(build_info); diff --git a/InvenTree/templates/js/translated/build.js b/InvenTree/templates/js/translated/build.js index a8026414b7a9..5556b8c89200 100644 --- a/InvenTree/templates/js/translated/build.js +++ b/InvenTree/templates/js/translated/build.js @@ -1109,8 +1109,7 @@ function loadBuildOutputTable(build_info, options={}) { setupFilterList('builditems', $(table), options.filterTarget || '#filter-list-incompletebuilditems', { labels: { - url: '{% url "api-stockitem-label-list" %}', - key: 'item', + model_type: 'stockitem', }, singular_name: '{% trans "build output" %}', plural_name: '{% trans "build outputs" %}', @@ -1123,29 +1122,31 @@ function loadBuildOutputTable(build_info, options={}) { }); // Request list of required tests for the part being assembled - inventreeGet( - '{% url "api-part-test-template-list" %}', - { - part: build_info.part, - required: true, - enabled: true, - }, - { - async: false, - success: function(response) { - test_templates = []; - response.forEach(function(item) { - // Only include "required" tests - if (item.required) { - test_templates.push(item); - } - }); + if (build_info.trackable) { + inventreeGet( + '{% url "api-part-test-template-list" %}', + { + part: build_info.part, + required: true, + enabled: true, }, - error: function() { - test_templates = []; + { + async: false, + success: function(response) { + test_templates = []; + response.forEach(function(item) { + // Only include "required" tests + if (item.required) { + test_templates.push(item); + } + }); + }, + error: function() { + test_templates = []; + } } - } - ); + ); + } // Callback function to load the allocated stock items function reloadOutputAllocations() { @@ -2004,7 +2005,6 @@ function loadBuildTable(table, options) { setupFilterList('build', table, filterTarget, { download: true, report: { - url: '{% url "api-build-report-list" %}', key: 'build', } }); @@ -2450,8 +2450,7 @@ function loadBuildLineTable(table, build_id, options={}) { if (!options.data) { setupFilterList('buildlines', $(table), filterTarget, { labels: { - url: '{% url "api-buildline-label-list" %}', - key: 'line', + modeltype: 'buildline', }, singular_name: '{% trans "build line" %}', plural_name: '{% trans "build lines" %}',