From b7da959dbde18f05aa34da9e38c38303d0603674 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 10 May 2024 15:36:35 +1000 Subject: [PATCH] Trackable build part fix (#7196) * Build Order Page fix: - Do not request test information for non trackable parts * Typo fix --- .../build/templates/build/detail.html | 1 + .../templates/js/translated/build.js | 51 +++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/backend/InvenTree/build/templates/build/detail.html b/src/backend/InvenTree/build/templates/build/detail.html index 3d2e5d4e96..a33c9c9781 100644 --- a/src/backend/InvenTree/build/templates/build/detail.html +++ b/src/backend/InvenTree/build/templates/build/detail.html @@ -366,6 +366,7 @@ onPanelLoad('outputs', function() { source_location: {{ build.take_from.pk }}, {% endif %} tracked_parts: true, + trackable: {% js_bool build.part.trackable %} }; loadBuildOutputTable(build_info); diff --git a/src/backend/InvenTree/templates/js/translated/build.js b/src/backend/InvenTree/templates/js/translated/build.js index e5dfa968cf..f761296f8f 100644 --- a/src/backend/InvenTree/templates/js/translated/build.js +++ b/src/backend/InvenTree/templates/js/translated/build.js @@ -1111,8 +1111,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" %}', @@ -1125,29 +1124,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() { @@ -2006,7 +2007,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" %}',