Export stock based on part

This commit is contained in:
Oliver Walters 2019-09-08 23:58:40 +10:00
parent 231a669fe5
commit fff42e7dbb
2 changed files with 18 additions and 1 deletions

View File

@ -76,12 +76,14 @@ function loadStockTable(table, options) {
}
else if (field == 'quantity') {
var stock = 0;
var items = 0;
data.forEach(function(item) {
stock += item.quantity;
items += 1;
});
return stock;
return stock + " (" + items + " items)";
} else if (field == 'batch') {
var batches = [];

View File

@ -47,6 +47,21 @@
url: "{% url 'api-stock-list' %}",
});
$("#stock-export").click(function() {
launchModalForm("{% url 'stock-export-options' %}", {
submit_text: "Export",
success: function(response) {
var url = "{% url 'stock-export' %}";
url += "?format=" + response.format;
url += "&cascade=" + response.cascade;
url += "&part={{ part.id }}";
location.href = url;
},
});
});
$('#item-create').click(function () {
launchModalForm("{% url 'stock-item-create' %}", {
reload: true,