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

Add notes field to stock actions

This commit is contained in:
Oliver Walters
2020-04-10 00:10:39 +10:00
parent b10931f3b6
commit 5a9dead4e6
4 changed files with 39 additions and 14 deletions

View File

@ -85,8 +85,6 @@ class InvenTreeModel {
*/
Future<bool> reload() async {
print("Reloading data from $url");
var response = await api.get(url, params: defaultGetFilters());
if (response.statusCode != 200) {

View File

@ -157,7 +157,7 @@ class InvenTreeStockItem extends InvenTreeModel {
return item;
}
Future<http.Response> countStock(double quan) async {
Future<http.Response> countStock(double quan, {String notes}) async {
// Cannot 'count' a serialized StockItem
if (isSerialized()) {
@ -172,12 +172,13 @@ class InvenTreeStockItem extends InvenTreeModel {
return api.post("/stock/count/", body: {
"item": {
"pk": "${pk}",
"quantity": "${quan}"
}
"quantity": "${quan}",
},
"notes": notes ?? '',
});
}
Future<http.Response> addStock(double quan) async {
Future<http.Response> addStock(double quan, {String notes}) async {
if (isSerialized() || quan <= 0) return null;
@ -185,11 +186,12 @@ class InvenTreeStockItem extends InvenTreeModel {
"item": {
"pk": "${pk}",
"quantity": "${quan}",
}
},
"notes": notes ?? '',
});
}
Future<http.Response> removeStock(double quan) async {
Future<http.Response> removeStock(double quan, {String notes}) async {
if (isSerialized() || quan <= 0) return null;
@ -197,7 +199,8 @@ class InvenTreeStockItem extends InvenTreeModel {
"item": {
"pk": "${pk}",
"quantity": "${quan}",
}
},
"notes": notes ?? '',
});
}