diff --git a/lib/api.dart b/lib/api.dart index b8a4f21f..d8b73dcb 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -326,6 +326,8 @@ class InvenTreeAPI { // Does the server support extra fields on stock adjustment actions? bool get supportsStockAdjustExtraFields => isConnected() && apiVersion >= 133; + bool get supportsBarcodePOReceiveEndpoint => isConnected() && apiVersion >= 135; + // Are plugins enabled on the server? bool _pluginsEnabled = false; diff --git a/lib/widget/location_display.dart b/lib/widget/location_display.dart index 3a6b7108..4e89f86a 100644 --- a/lib/widget/location_display.dart +++ b/lib/widget/location_display.dart @@ -104,18 +104,20 @@ class _LocationDisplayState extends RefreshableState { ); } - actions.add( - SpeedDialChild( - child: Icon(Icons.barcode_reader), - label: L10().scanReceivedParts, - onTap:() async { - scanBarcode( - context, - handler: POReceiveBarcodeHandler(location: location), - ); - }, - ) - ); + if (api.supportsBarcodePOReceiveEndpoint) { + actions.add( + SpeedDialChild( + child: Icon(Icons.barcode_reader), + label: L10().scanReceivedParts, + onTap:() async { + scanBarcode( + context, + handler: POReceiveBarcodeHandler(location: location), + ); + }, + ) + ); + } // Scan this location into another one if (InvenTreeStockLocation().canEdit) { diff --git a/lib/widget/purchase_order_detail.dart b/lib/widget/purchase_order_detail.dart index 370419b5..f03d4f0b 100644 --- a/lib/widget/purchase_order_detail.dart +++ b/lib/widget/purchase_order_detail.dart @@ -137,18 +137,20 @@ class _PurchaseOrderDetailState extends RefreshableState barcodeButtons(BuildContext context) { List actions = []; - actions.add( - SpeedDialChild( - child: Icon(Icons.barcode_reader), - label: L10().scanReceivedParts, - onTap:() async { - scanBarcode( - context, - handler: POReceiveBarcodeHandler(purchaseOrder: order), - ); - }, - ) - ); + if (api.supportsBarcodePOReceiveEndpoint) { + actions.add( + SpeedDialChild( + child: Icon(Icons.barcode_reader), + label: L10().scanReceivedParts, + onTap:() async { + scanBarcode( + context, + handler: POReceiveBarcodeHandler(purchaseOrder: order), + ); + }, + ) + ); + } return actions; } diff --git a/lib/widget/purchase_order_list.dart b/lib/widget/purchase_order_list.dart index 7e21cc8a..44046564 100644 --- a/lib/widget/purchase_order_list.dart +++ b/lib/widget/purchase_order_list.dart @@ -84,18 +84,20 @@ class _PurchaseOrderListWidgetState extends RefreshableState barcodeButtons(BuildContext context) { List actions = []; - actions.add( - SpeedDialChild( - child: Icon(Icons.barcode_reader), - label: L10().scanReceivedParts, - onTap:() async { - scanBarcode( - context, - handler: POReceiveBarcodeHandler(), - ); - }, - ) - ); + if (api.supportsBarcodePOReceiveEndpoint) { + actions.add( + SpeedDialChild( + child: Icon(Icons.barcode_reader), + label: L10().scanReceivedParts, + onTap:() async { + scanBarcode( + context, + handler: POReceiveBarcodeHandler(), + ); + }, + ) + ); + } return actions; }