2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-17 04:35:26 +00:00

Add function to remove stock

This commit is contained in:
Oliver Walters
2020-04-09 23:49:39 +10:00
parent f5b8311428
commit b10931f3b6
2 changed files with 82 additions and 16 deletions

View File

@ -179,15 +179,7 @@ class InvenTreeStockItem extends InvenTreeModel {
Future<http.Response> addStock(double quan) async {
// Cannot add stock to a serialized StockItem
if (isSerialized()) {
return null;
}
// Cannot add negative stock
if (quan <= 0) {
return null;
}
if (isSerialized() || quan <= 0) return null;
return api.post("/stock/add/", body: {
"item": {
@ -197,6 +189,18 @@ class InvenTreeStockItem extends InvenTreeModel {
});
}
Future<http.Response> removeStock(double quan) async {
if (isSerialized() || quan <= 0) return null;
return api.post("/stock/remove/", body: {
"item": {
"pk": "${pk}",
"quantity": "${quan}",
}
});
}
}