Add notes field to stock actions

This commit is contained in:
Oliver Walters committed 2020-04-10 00:10:39 +10:00
1 parent b10931f3b6
commit 5a9dead4e6
4 files changed
+39 -14

No files matched your search

-2
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) {
+10 -7
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 ?? '',
});
}