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

Refactorin'

This commit is contained in:
Oliver 2021-08-15 15:34:40 +10:00
parent 3e3ab680f6
commit a4c96694bb
2 changed files with 11 additions and 8 deletions

View File

@ -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}'";
}

View File

@ -107,15 +107,17 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
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();
}