2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 05:26:47 +00:00

Upload test result against a StockItem object

This commit is contained in:
Oliver Walters 2020-05-24 10:07:46 +10:00
parent d666bdb957
commit ec1f9a8923

View File

@ -128,6 +128,25 @@ class InvenTreeStockItem extends InvenTreeModel {
});
}
Future<bool> uploadTestResult(BuildContext context, String testName, bool result, {String value, String notes}) async {
Map<String, dynamic> 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;