2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 04:55:44 +00:00

Extract serial numbers from submitted form data

This commit is contained in:
Oliver
2022-02-15 13:19:41 +11:00
parent 037232c177
commit 24c13b04b6
2 changed files with 20 additions and 4 deletions

View File

@ -205,6 +205,18 @@ function createBuildOutput(build_id, options) {
auto_allocate: {},
};
// Work out the next available serial numbers
inventreeGet(`/api/part/${build.part}/serial-numbers/`, {}, {
success: function(data) {
if (data.next) {
fields.serial_numbers.placeholder = `{% trans "Next available serial number" %}: ${data.next}`;
} else {
fields.serial_numbers.placeholder = `{% trans "Latest serial number" %}: ${data.latest}`;
}
},
async: false,
});
if (options.trackable_parts) {
html += `
<div class='alert alert-block alert-info'>
@ -229,6 +241,9 @@ function createBuildOutput(build_id, options) {
confirm: true,
fields: fields,
preFormContent: html,
onSuccess: function(response) {
location.reload();
},
});
}