mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 19:46:25 +00:00
Refactorin'
This commit is contained in:
parent
3e3ab680f6
commit
a4c96694bb
2 changed files with 11 additions and 8 deletions
|
|
@ -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}'";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue