Trackable build part fix (#7196)

* Build Order Page fix:

- Do not request test information for non trackable parts

* Typo fix
This commit is contained in:
Oliver 2024-05-10 15:36:35 +10:00 committed by GitHub
parent 29fa5cfafa
commit b7da959dbd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 26 deletions

View File

@ -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);

View File

@ -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" %}',