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:
@ -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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user