From 5418a71207e92a84b0add8dce7a8ce5abf80b061 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 1 Sep 2026 23:55:01 +1000 Subject: [PATCH] Top level fix (#874) * Fix top-level items * Show pagination error messages * Update release notes * Check API version --- assets/release_notes.md | 7 +++++++ lib/api.dart | 3 +++ lib/inventree/model.dart | 6 ++++++ lib/widget/part/category_display.dart | 7 ++++++- lib/widget/stock/location_display.dart | 7 ++++++- pubspec.yaml | 2 +- 6 files changed, 29 insertions(+), 3 deletions(-) diff --git a/assets/release_notes.md b/assets/release_notes.md index 528233cd..1dc38bc0 100644 --- a/assets/release_notes.md +++ b/assets/release_notes.md @@ -1,3 +1,10 @@ +## 0.25.2 - August 2026 +--- + +- Bug fix for part location display +- Bug fix for stock location display +- Updated translations + ## 0.25.1 - August 2026 --- diff --git a/lib/api.dart b/lib/api.dart index 303f80b6..015e183a 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -308,6 +308,9 @@ class InvenTreeAPI { bool get supportsUserPermissions => apiVersion >= 207; + // Ref: https://github.com/inventree/InvenTree/pull/7514 + bool get supportsTopLevelFiltering => apiVersion >= 209; + // Does the server support the "destination" field on the PurchaseOrder model? // Ref: https://github.com/inventree/InvenTree/pull/8403 bool get supportsPurchaseOrderDestination => apiVersion >= 276; diff --git a/lib/inventree/model.dart b/lib/inventree/model.dart index 3a39e64f..ea6ed5d7 100644 --- a/lib/inventree/model.dart +++ b/lib/inventree/model.dart @@ -752,6 +752,12 @@ class InvenTreeModel { return null; } + // A client error (e.g. 400 Bad Request) was returned - notify the user + if (response.clientError()) { + showStatusCodeError(URL, response.statusCode, details: response.data); + return null; + } + // Construct the response InvenTreePageResponse page = InvenTreePageResponse(); diff --git a/lib/widget/part/category_display.dart b/lib/widget/part/category_display.dart index 1d94f80d..f1854eed 100644 --- a/lib/widget/part/category_display.dart +++ b/lib/widget/part/category_display.dart @@ -1,6 +1,7 @@ import "package:flutter/material.dart"; import "package:flutter_speed_dial/flutter_speed_dial.dart"; import "package:flutter_tabler_icons/flutter_tabler_icons.dart"; +import "package:inventree/api.dart"; import "package:inventree/app_colors.dart"; import "package:inventree/l10.dart"; @@ -193,7 +194,11 @@ class _CategoryDisplayState extends RefreshableState { if (parent != null) { filters["parent"] = parent.toString(); } else { - filters["parent"] = "null"; + if (InvenTreeAPI().supportsTopLevelFiltering) { + filters["top_level"] = "true"; + } else { + filters["parent"] = "null"; + } } List tiles = [ diff --git a/lib/widget/stock/location_display.dart b/lib/widget/stock/location_display.dart index 066da764..9f1ace25 100644 --- a/lib/widget/stock/location_display.dart +++ b/lib/widget/stock/location_display.dart @@ -1,6 +1,7 @@ import "package:flutter/material.dart"; import "package:flutter_speed_dial/flutter_speed_dial.dart"; import "package:flutter_tabler_icons/flutter_tabler_icons.dart"; +import "package:inventree/api.dart"; import "package:inventree/app_colors.dart"; import "package:inventree/barcode/barcode.dart"; @@ -361,7 +362,11 @@ class _LocationDisplayState extends RefreshableState { if (parent != null) { filters["parent"] = parent.toString(); } else { - filters["parent"] = "null"; + if (InvenTreeAPI().supportsTopLevelFiltering) { + filters["top_level"] = "true"; + } else { + filters["parent"] = "null"; + } } List tiles = [ diff --git a/pubspec.yaml b/pubspec.yaml index 8214ba55..a8ff1881 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: inventree description: InvenTree stock management -version: 0.25.1+124 +version: 0.25.2+125 environment: sdk: ^3.8.1