diff --git a/assets/release_notes.md b/assets/release_notes.md index 23647b12..40382d3a 100644 --- a/assets/release_notes.md +++ b/assets/release_notes.md @@ -2,6 +2,8 @@ --- - Adds ability to create new companies from the app - Allow creation of line items against pending sales orders +- Display start date for purchase orders +- Display start date for sales orders - Updated search functionality - Updated translations diff --git a/lib/api.dart b/lib/api.dart index 90f02a81..4dfe3561 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -287,61 +287,65 @@ class InvenTreeAPI { int get apiVersion => (serverInfo["apiVersion"] ?? 1) as int; // Consolidated search request API v102 or newer - bool get supportsConsolidatedSearch => isConnected() && apiVersion >= 102; + bool get supportsConsolidatedSearch =>apiVersion >= 102; // ReturnOrder supports API v104 or newer - bool get supportsReturnOrders => isConnected() && apiVersion >= 104; + bool get supportsReturnOrders =>apiVersion >= 104; // "Contact" model exposed to API - bool get supportsContactModel => isConnected() && apiVersion >= 104; + bool get supportsContactModel =>apiVersion >= 104; // Status label endpoints API v105 or newer - bool get supportsStatusLabelEndpoints => isConnected() && apiVersion >= 105; + bool get supportsStatusLabelEndpoints =>apiVersion >= 105; // Regex search API v106 or newer - bool get supportsRegexSearch => isConnected() && apiVersion >= 106; + bool get supportsRegexSearch =>apiVersion >= 106; // Order barcodes API v107 or newer - bool get supportsOrderBarcodes => isConnected() && apiVersion >= 107; + bool get supportsOrderBarcodes =>apiVersion >= 107; // Project codes require v109 or newer - bool get supportsProjectCodes => isConnected() && apiVersion >= 109; + bool get supportsProjectCodes =>apiVersion >= 109; // Does the server support extra fields on stock adjustment actions? - bool get supportsStockAdjustExtraFields => isConnected() && apiVersion >= 133; + bool get supportsStockAdjustExtraFields =>apiVersion >= 133; // Does the server support receiving items against a PO using barcodes? - bool get supportsBarcodePOReceiveEndpoint => isConnected() && apiVersion >= 139; + bool get supportsBarcodePOReceiveEndpoint =>apiVersion >= 139; // Does the server support adding line items to a PO using barcodes? - bool get supportsBarcodePOAddLineEndpoint => isConnected() && apiVersion >= 153; + bool get supportsBarcodePOAddLineEndpoint =>apiVersion >= 153; // Does the server support allocating stock to sales order using barcodes? - bool get supportsBarcodeSOAllocateEndpoint => isConnected() && apiVersion >= 160; + bool get supportsBarcodeSOAllocateEndpoint =>apiVersion >= 160; // Does the server support the "modern" test results API // Ref: https://github.com/inventree/InvenTree/pull/6430/ - bool get supportsModernTestResults => isConnected() && apiVersion >= 169; + bool get supportsModernTestResults =>apiVersion >= 169; // Does the server support "null" top-level filtering for PartCategory and StockLocation endpoints? - bool get supportsNullTopLevelFiltering => isConnected() && apiVersion < 174; + bool get supportsNullTopLevelFiltering =>apiVersion < 174; // Does the server support "active" status on Company and SupplierPart API endpoints? - bool get supportsCompanyActiveStatus => isConnected() && apiVersion >= 189; + bool get supportsCompanyActiveStatus =>apiVersion >= 189; // Does the server support the "modern" (consolidated) label printing API? - bool get supportsModernLabelPrinting => isConnected() && apiVersion >= 201; + bool get supportsModernLabelPrinting =>apiVersion >= 201; // Does the server support the "modern" (consolidated) attachment API? // Ref: https://github.com/inventree/InvenTree/pull/7420 - bool get supportsModernAttachments => isConnected() && apiVersion >= 207; + bool get supportsModernAttachments =>apiVersion >= 207; // Does the server support the "destination" field on the PurchaseOrder model? // Ref: https://github.com/inventree/InvenTree/pull/8403 - bool get supportsPurchaseOrderDestination => isConnected() && apiVersion >= 276; + bool get supportsPurchaseOrderDestination =>apiVersion >= 276; + + // Does the server support the "start_date" field for orders? + // Ref: https://github.com/inventree/InvenTree/pull/8966 + bool get supportsStartDate =>apiVersion >= 306; // Supports separate search against "supplier" / "customer" / "manufacturer" - bool get supportsSplitCompanySearch => isConnected() && apiVersion >= 315; + bool get supportsSplitCompanySearch =>apiVersion >= 315; // Cached list of plugins (refreshed when we connect to the server) List _plugins = []; diff --git a/lib/inventree/orders.dart b/lib/inventree/orders.dart index b596fc0d..b22247a5 100644 --- a/lib/inventree/orders.dart +++ b/lib/inventree/orders.dart @@ -18,6 +18,8 @@ class InvenTreeOrder extends InvenTreeModel { String get issueDate => getString("issue_date"); + String get startDate => getString("start_date"); + String get completionDate => getDateString("complete_date"); String get creationDate => getDateString("creation_date"); diff --git a/lib/inventree/purchase_order.dart b/lib/inventree/purchase_order.dart index c258c8b6..72f12219 100644 --- a/lib/inventree/purchase_order.dart +++ b/lib/inventree/purchase_order.dart @@ -46,6 +46,7 @@ class InvenTreePurchaseOrder extends InvenTreeOrder { "description": {}, "project_code": {}, "destination": {}, + "start_date": {}, "target_date": {}, "link": {}, "responsible": {}, @@ -64,6 +65,10 @@ class InvenTreePurchaseOrder extends InvenTreeOrder { fields.remove("destination"); } + if (!InvenTreeAPI().supportsStartDate) { + fields.remove("start_date"); + } + return fields; } diff --git a/lib/inventree/sales_order.dart b/lib/inventree/sales_order.dart index 7372250b..ea82d786 100644 --- a/lib/inventree/sales_order.dart +++ b/lib/inventree/sales_order.dart @@ -43,6 +43,7 @@ class InvenTreeSalesOrder extends InvenTreeOrder { "customer_reference": {}, "description": {}, "project_code": {}, + "start_date": {}, "target_date": {}, "link": {}, "responsible": {}, @@ -61,6 +62,10 @@ class InvenTreeSalesOrder extends InvenTreeOrder { fields.remove("contact"); } + if (!InvenTreeAPI().supportsStartDate) { + fields.remove("start_date"); + } + return fields; } diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 07d2d46b..effb1255 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -1308,6 +1308,9 @@ "soundOnServerError": "Play audible tone on server error", "@soundOnServerError": {}, + "startDate": "Start Date", + "@startDate": {}, + "status": "Status", "@status": {}, diff --git a/lib/widget/order/purchase_order_detail.dart b/lib/widget/order/purchase_order_detail.dart index 8dd84698..2afc66dc 100644 --- a/lib/widget/order/purchase_order_detail.dart +++ b/lib/widget/order/purchase_order_detail.dart @@ -431,6 +431,14 @@ class _PurchaseOrderDetailState extends RefreshableState { // TODO: total price + if (widget.order.startDate.isNotEmpty) { + tiles.add(ListTile( + title: Text(L10().startDate), + trailing: Text(widget.order.startDate), + leading: Icon(TablerIcons.calendar), + )); + } + if (widget.order.targetDate.isNotEmpty) { tiles.add(ListTile( title: Text(L10().targetDate),