2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 19:20:55 +00:00

Create new stock location via API forms

This commit is contained in:
Oliver
2021-11-02 20:04:25 +11:00
parent 0d9c08b49c
commit ef305032c9
5 changed files with 32 additions and 79 deletions

View File

@ -59,13 +59,19 @@
function stockLocationFields(options={}) {
return {
var fields = {
parent: {
help_text: '{% trans "Parent stock location" %}',
},
name: {},
description: {},
};
if (options.parent) {
fields.parent.value = options.parent;
}
return fields;
}
@ -82,6 +88,20 @@ function editStockLocation(pk, options={}) {
}
/*
* Launch an API form to create a new stock location
*/
function createStockLocation(options={}) {
var url = '{% url "api-location-list" %}';
options.method = 'POST';
options.fields = stockLocationFields(options);
constructForm(url, options);
}
function stockItemFields(options={}) {
var fields = {
part: {},