From bb781aaed53246a7e7475afd04167b78af906eeb Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 21 Apr 2023 21:24:06 +1000 Subject: [PATCH] Allow stock items to be created from top-level location (#338) (cherry picked from commit fd85abf9d8e4760dd3ed793cf38d3bc5c29f17b8) --- lib/widget/location_display.dart | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/widget/location_display.dart b/lib/widget/location_display.dart index 9f74e8bf..d693314b 100644 --- a/lib/widget/location_display.dart +++ b/lib/widget/location_display.dart @@ -157,7 +157,7 @@ class _LocationDisplayState extends RefreshableState { } // Create new item - if (location != null && InvenTreeStockItem().canCreate) { + if (InvenTreeStockItem().canCreate) { actions.add( SpeedDialChild( child: FaIcon(FontAwesomeIcons.boxesStacked), @@ -243,11 +243,6 @@ class _LocationDisplayState extends RefreshableState { * Launch a dialog form to create a new stock item */ Future _newStockItem(BuildContext context) async { - int pk = location?.pk ?? -1; - - if (location != null && pk <= 0) { - return; - } var fields = InvenTreeStockItem().formFields(); @@ -258,7 +253,7 @@ class _LocationDisplayState extends RefreshableState { context, L10().stockItemCreate, data: { - "location": location != null ? pk : null, + "location": location != null ? location!.pk : null, }, fields: fields, onSuccess: (result) async {