mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-27 21:16:48 +00:00
Filter fix (#473)
* Add check for "null" top level locations and categories * Fix API - Top level location and category broken after API 174 - Ref: https://github.com/inventree/InvenTree/pull/6536
This commit is contained in:
parent
1d41d229ca
commit
a889c4adbe
@ -1,7 +1,9 @@
|
|||||||
### 0.14.2 - January 2024
|
### 0.14.2 - February 2024
|
||||||
---
|
---
|
||||||
|
|
||||||
- Updated error reporting
|
- Updated error reporting
|
||||||
|
- Support for updated server API endpoints
|
||||||
|
- Updated translations
|
||||||
|
|
||||||
### 0.14.1 - January 2024
|
### 0.14.1 - January 2024
|
||||||
---
|
---
|
||||||
|
@ -339,6 +339,9 @@ class InvenTreeAPI {
|
|||||||
// Does the server support allocating stock to sales order using barcodes?
|
// Does the server support allocating stock to sales order using barcodes?
|
||||||
bool get supportsBarcodeSOAllocateEndpoint => isConnected() && apiVersion >= 160;
|
bool get supportsBarcodeSOAllocateEndpoint => isConnected() && apiVersion >= 160;
|
||||||
|
|
||||||
|
// Does the server support "null" top-level filtering for PartCategory and StockLocation endpoints?
|
||||||
|
bool get supportsNullTopLevelFiltering => isConnected() && apiVersion < 174;
|
||||||
|
|
||||||
// Cached list of plugins (refreshed when we connect to the server)
|
// Cached list of plugins (refreshed when we connect to the server)
|
||||||
List<InvenTreePlugin> _plugins = [];
|
List<InvenTreePlugin> _plugins = [];
|
||||||
|
|
||||||
|
@ -200,13 +200,21 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
|||||||
// Construct the "details" panel
|
// Construct the "details" panel
|
||||||
List<Widget> detailTiles() {
|
List<Widget> detailTiles() {
|
||||||
|
|
||||||
|
Map<String, String> filters = {};
|
||||||
|
|
||||||
|
int? parent = widget.category?.pk;
|
||||||
|
|
||||||
|
if (parent != null) {
|
||||||
|
filters["parent"] = parent.toString();
|
||||||
|
} else if (api.supportsNullTopLevelFiltering) {
|
||||||
|
filters["parent"] = "null";
|
||||||
|
}
|
||||||
|
|
||||||
List<Widget> tiles = <Widget>[
|
List<Widget> tiles = <Widget>[
|
||||||
getCategoryDescriptionCard(),
|
getCategoryDescriptionCard(),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: PaginatedPartCategoryList(
|
child: PaginatedPartCategoryList(
|
||||||
{
|
filters,
|
||||||
"parent": widget.category?.pk.toString() ?? "null"
|
|
||||||
},
|
|
||||||
title: L10().subcategories,
|
title: L10().subcategories,
|
||||||
),
|
),
|
||||||
flex: 10,
|
flex: 10,
|
||||||
|
@ -393,13 +393,22 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
|
|||||||
|
|
||||||
// Construct the "details" panel
|
// Construct the "details" panel
|
||||||
List<Widget> detailTiles() {
|
List<Widget> detailTiles() {
|
||||||
|
|
||||||
|
Map<String, String> filters = {};
|
||||||
|
|
||||||
|
int? parent = location?.pk;
|
||||||
|
|
||||||
|
if (parent != null) {
|
||||||
|
filters["parent"] = parent.toString();
|
||||||
|
} else if (api.supportsNullTopLevelFiltering) {
|
||||||
|
filters["parent"] = "null";
|
||||||
|
}
|
||||||
|
|
||||||
List<Widget> tiles = [
|
List<Widget> tiles = [
|
||||||
locationDescriptionCard(),
|
locationDescriptionCard(),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: PaginatedStockLocationList(
|
child: PaginatedStockLocationList(
|
||||||
{
|
filters,
|
||||||
"parent": location?.pk.toString() ?? "null",
|
|
||||||
},
|
|
||||||
title: L10().sublocations,
|
title: L10().sublocations,
|
||||||
),
|
),
|
||||||
flex: 10,
|
flex: 10,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user