2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-30 18:50:53 +00:00

Add auto-fill option to select2 inputs on API forms

- WIll fill input if a single result is returned
This commit is contained in:
Oliver
2021-10-05 00:39:22 +11:00
parent 8a90b9df6d
commit 416ba51e22
4 changed files with 44 additions and 6 deletions

View File

@ -383,7 +383,7 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
partId,
{
success: function(data) {
console.log("here we go I guess");
// TODO: Reload table
},
parts: [
parseInt(pk),
@ -959,13 +959,17 @@ function allocateStockToBuild(build_id, part_id, options={}) {
filters: {
part: bom_item.sub_part,
in_stock: true,
part_detail: true,
part_detail: false,
location_detail: true,
},
model: 'stockitem',
required: true,
render_part_detail: false,
render_location_detail: true,
// TODO: Auto-assign value?
auto_fill: true,
noResults: function(query) {
return '{% trans "No matching stock items" %}';
}
},
null,
options,