2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-12 10:15:32 +00:00

Create new stock item

This commit is contained in:
Oliver
2021-08-15 14:44:40 +10:00
parent a09d0b6887
commit 3fb6b38930
4 changed files with 78 additions and 2 deletions

View File

@ -163,7 +163,31 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
Future<void> _newStockItem(BuildContext context) async {
// TODO
int pk = location?.pk ?? -1;
if (pk <= 0) {
return;
}
InvenTreeStockItem().createForm(
context,
L10().stockItemCreate,
data: {
"location": pk,
},
onSuccess: (data) async {
if (data.containsKey("pk")) {
var item = InvenTreeStockItem.fromJson(data);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => StockDetailWidget(item)
)
);
}
}
);
}
@ -320,6 +344,17 @@ List<Widget> detailTiles() {
)
);
tiles.add(
ListTile(
title: Text(L10().stockItemCreate),
subtitle: Text(L10().stockItemCreateDetail),
leading: FaIcon(FontAwesomeIcons.boxes, color: COLOR_CLICK),
onTap: () async {
_newStockItem(context);
},
)
);
}
if (location != null) {