2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 13:05:42 +00:00

Adds API endpoint for "auto allocating" stock items against a build order.

- If stock exists in multiple locations, and the user "does not care" where to take from, simply iterate through and take
This commit is contained in:
Oliver
2022-03-04 15:26:00 +11:00
parent 004ced8030
commit 434f563a41
6 changed files with 214 additions and 5 deletions

View File

@ -20,6 +20,7 @@
/* exported
allocateStockToBuild,
autoAllocateStockToBuild,
completeBuildOrder,
createBuildOutput,
editBuildOrder,
@ -1844,6 +1845,34 @@ function allocateStockToBuild(build_id, part_id, bom_items, options={}) {
}
/**
* Automatically allocate stock items to a build
*/
function autoAllocateStockToBuild(build_id, bom_items=[], options={}) {
var html = '';
var fields = {
location: {
value: options.location,
},
interchangeable: {},
substitutes: {},
}
constructForm(`/api/build/${build_id}/auto-allocate/`, {
method: 'POST',
fields: fields,
title: '{% trans "Allocate Stock Items" %}',
confirm: true,
preFormContent: html,
onSuccess: function(response) {
// TODO - Reload the allocation table
}
});
}
/*
* Display a table of Build orders
*/