mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 03:26:24 +00:00
Add barcode handler to scan stock item into location
This commit is contained in:
parent
db6aae8a78
commit
c00e367ae5
3 changed files with 53 additions and 9 deletions
|
|
@ -379,20 +379,26 @@ class InvenTreeStockItem extends InvenTreeModel {
|
|||
});
|
||||
}
|
||||
|
||||
Future<http.Response> transferStock(double q, int location, {String notes}) async {
|
||||
Future<http.Response> transferStock(int location, {double quantity, String notes}) async {
|
||||
if (quantity == null) {} else
|
||||
if ((quantity < 0) || (quantity > this.quantity)) {
|
||||
quantity = this.quantity;
|
||||
}
|
||||
|
||||
if ((q == null) || (q > quantity)) q = quantity;
|
||||
|
||||
return api.post("/stock/transfer/", body: {
|
||||
Map<String, dynamic> data = {
|
||||
"item": {
|
||||
"pk": "${pk}",
|
||||
"quantity": "${q}",
|
||||
},
|
||||
},
|
||||
"location": "${location}",
|
||||
"notes": notes ?? '',
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if (quantity != null) {
|
||||
data["item"]["quantity"] = "${quantity}";
|
||||
}
|
||||
|
||||
return api.post("/stock/transfer/", body: data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue