mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 03:26:24 +00:00
Add function to remove stock
This commit is contained in:
parent
f5b8311428
commit
b10931f3b6
2 changed files with 82 additions and 16 deletions
|
|
@ -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}",
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue