From ec1f9a8923ffefb9a203042e0b4443c16734aaa8 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sun, 24 May 2020 10:07:46 +1000 Subject: [PATCH] Upload test result against a StockItem object --- lib/inventree/stock.dart | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/inventree/stock.dart b/lib/inventree/stock.dart index bfdc00a4..941e6aff 100644 --- a/lib/inventree/stock.dart +++ b/lib/inventree/stock.dart @@ -128,6 +128,25 @@ class InvenTreeStockItem extends InvenTreeModel { }); } + Future uploadTestResult(BuildContext context, String testName, bool result, {String value, String notes}) async { + + Map data = { + "stock_item": pk, + "test": testName, + "result": result, + }; + + if (value != null && !value.isEmpty) { + data["value"] = value; + } + + if (notes != null && !notes.isEmpty) { + data["notes"] = notes; + } + + InvenTreeStockItemTestResult().create(context, data); + } + int get partId => jsondata['part'] ?? -1; int get trackingItemCount => jsondata['tracking_items'] as int ?? 0;