From 432558678d91117755afef1ed52227e28620dd2b Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 19 Apr 2021 22:07:52 +1000 Subject: [PATCH] Bug fix - duplicate stock transfer action --- lib/inventree/stock.dart | 27 +++++++++++---------------- lib/widget/stock_detail.dart | 1 - 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/lib/inventree/stock.dart b/lib/inventree/stock.dart index a54c6ec0..e0b15e05 100644 --- a/lib/inventree/stock.dart +++ b/lib/inventree/stock.dart @@ -484,23 +484,18 @@ class InvenTreeStockItem extends InvenTreeModel { quantity = this.quantity; } - Map data = { - "item": { - "pk": "${pk}", + final response = await api.post( + "/stock/transfer/", + body: { + "item": { + "pk": "${pk}", + "quantity": "${quantity}", + }, + "location": "${location}", + "notes": notes ?? "", }, - "location": "${location}", - "notes": notes ?? '', - }; - - if (quantity != null) { - data["item"]["quantity"] = "${quantity}"; - } - - print("transfer stock!"); - - final response = await api.post("/stock/transfer/", body: data); - - print("transfer response: ${response}"); + expectedStatusCode: 200 + ); return response != null; } diff --git a/lib/widget/stock_detail.dart b/lib/widget/stock_detail.dart index 1b009641..1f5e3323 100644 --- a/lib/widget/stock_detail.dart +++ b/lib/widget/stock_detail.dart @@ -314,7 +314,6 @@ class _StockItemDisplayState extends RefreshableState { _selectedController.text = selectedLocation.pathstring; }, onSaved: (value) { - _transferStock(context, selectedLocation); }, itemBuilder: (context, suggestion) { var location = suggestion as InvenTreeStockLocation;