diff --git a/assets/release_notes.md b/assets/release_notes.md index ef92d2d8..2bd10694 100644 --- a/assets/release_notes.md +++ b/assets/release_notes.md @@ -1,6 +1,14 @@ ## InvenTree App Release Notes --- +### - December 2022 +--- + +- Add support for structural part categories +- Add support for structural stock locations +- Updated translations + + ### 0.8.3 - September 2022 --- diff --git a/lib/api.dart b/lib/api.dart index b32f4c4a..d8dc6503 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -259,6 +259,9 @@ class InvenTreeAPI { // Notification support requires API v25 or newer bool get supportsNotifications => isConnected() && apiVersion >= 25; + // Structural categories requires API v83 or newer + bool get supportsStructuralCategories => isConnected() && apiVersion >= 83; + // Are plugins enabled on the server? bool _pluginsEnabled = false; diff --git a/lib/inventree/part.dart b/lib/inventree/part.dart index b1f22373..37095aaf 100644 --- a/lib/inventree/part.dart +++ b/lib/inventree/part.dart @@ -25,11 +25,18 @@ class InvenTreePartCategory extends InvenTreeModel { @override Map formFields() { - return { + Map fields = { "name": {}, "description": {}, - "parent": {} + "parent": {}, + "structural": {}, }; + + if (!api.supportsStructuralCategories) { + fields.remove("structural"); + } + + return fields; } String get pathstring => (jsondata["pathstring"] ?? "") as String; diff --git a/lib/inventree/stock.dart b/lib/inventree/stock.dart index fc21d8de..2e9e441b 100644 --- a/lib/inventree/stock.dart +++ b/lib/inventree/stock.dart @@ -652,13 +652,18 @@ class InvenTreeStockLocation extends InvenTreeModel { @override Map formFields() { - return { + Map fields = { "name": {}, "description": {}, - "parent": { - - }, + "parent": {}, + "structural": {}, }; + + if (!api.supportsStructuralCategories) { + fields.remove("structural"); + } + + return fields; } String get parentPathString {