mirror of
https://github.com/inventree/inventree-app.git
synced 2026-11-30 17:21:38 +00:00
Create new part from category
This commit is contained in:
1 parent
a1a07aefd8
commit
ed94d4eb96
1 file changed
+22
@@ -243,6 +243,28 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
||||
|
||||
Future<void> _newPart() async {
|
||||
|
||||
int pk = category?.pk ?? -1;
|
||||
|
||||
InvenTreePart().createForm(
|
||||
context,
|
||||
L10().partCreate,
|
||||
data: {
|
||||
"category": (pk > 0) ? pk : null
|
||||
},
|
||||
onSuccess: (data) async {
|
||||
|
||||
if (data.containsKey("pk")) {
|
||||
var part = InvenTreePart.fromJson(data);
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => PartDetailWidget(part)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> actionTiles(BuildContext context) {
|
||||
|
||||
Reference in new issue
Block a user