diff --git a/lib/api_form.dart b/lib/api_form.dart index 29ce5669..14df198b 100644 --- a/lib/api_form.dart +++ b/lib/api_form.dart @@ -278,10 +278,11 @@ class APIFormField { itemAsString: (dynamic item) { switch (model) { case "part": - return item["full_name"]; + return InvenTreePart.fromJson(item).fullname; case "partcategory": + return InvenTreePartCategory.fromJson(item).pathstring; case "stocklocation": - return item["pathstring"]; + return InvenTreeStockLocation.fromJson(item).pathstring; default: return "itemAsString not implemented for '${model}'"; } diff --git a/lib/widget/stock_detail.dart b/lib/widget/stock_detail.dart index 7d27ecb8..dd062cd6 100644 --- a/lib/widget/stock_detail.dart +++ b/lib/widget/stock_detail.dart @@ -107,15 +107,17 @@ class _StockItemDisplayState extends RefreshableState { void _editStockItem(BuildContext context) async { + var fields = InvenTreeStockItem().formFields(); + + // Some fields we don't want to edit! + fields.remove("part"); + fields.remove("quantity"); + fields.remove("location"); + item.editForm( context, L10().editItem, - fields: { - "status": {}, - "batch": {}, - "packaging": {}, - "link": {}, - }, + fields: fields, onSuccess: (data) async { refresh(); }