Skip to content

Commit

Permalink
Trackable build part fix (#7196) (#7197)
Browse files Browse the repository at this point in the history
* Build Order Page fix:

- Do not request test information for non trackable parts

* Typo fix

(cherry picked from commit b7da959)

Co-authored-by: Oliver <[email protected]>
  • Loading branch information
github-actions[bot] and SchrodingersGat authored May 10, 2024
1 parent 9869a35 commit 2a90cb4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
1 change: 1 addition & 0 deletions InvenTree/build/templates/build/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ <h4>{% trans "Build Notes" %}</h4>
source_location: {{ build.take_from.pk }},
{% endif %}
tracked_parts: true,
trackable: {% js_bool build.part.trackable %}
};

loadBuildOutputTable(build_info);
Expand Down
51 changes: 25 additions & 26 deletions InvenTree/templates/js/translated/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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" %}',
Expand All @@ -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() {
Expand Down Expand Up @@ -2004,7 +2005,6 @@ function loadBuildTable(table, options) {
setupFilterList('build', table, filterTarget, {
download: true,
report: {
url: '{% url "api-build-report-list" %}',
key: 'build',
}
});
Expand Down Expand Up @@ -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" %}',
Expand Down

0 comments on commit 2a90cb4

Please sign in to comment.