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:
@ -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}",
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user