Add extra filtering options for supplier parts (#868)

* Add extra filtering options for supplier parts

* Update release notes

* Allow edit of "primary" field
This commit is contained in:
Oliver
2026-08-28 21:45:16 +10:00
committed by GitHub
parent 94762fd523
commit 93a19b77f8
6 changed files with 42 additions and 0 deletions
+1
View File
@@ -1,6 +1,7 @@
## 0.xx.y - August 2026 ## 0.xx.y - August 2026
--- ---
- Additional filtering options for supplier parts
- Additional barcode support using data intents - Additional barcode support using data intents
- Improvements for build order display - Improvements for build order display
+3
View File
@@ -326,6 +326,9 @@ class InvenTreeAPI {
// Ref: https://github.com/inventree/InvenTree/pull/10699 // Ref: https://github.com/inventree/InvenTree/pull/10699
bool get supportsModernParameters => apiVersion >= 429; bool get supportsModernParameters => apiVersion >= 429;
// Does the support support the "primary" field on SupplierPart model?
bool get supportsSupplierPartPrimaryField => apiVersion >= 456;
// Does the server use the new "user/me/" endpoints? // Does the server use the new "user/me/" endpoints?
// Ref: https://github.com/inventree/InvenTree/pull/11963 // Ref: https://github.com/inventree/InvenTree/pull/11963
bool get supportsNewUserEndpoints => apiVersion >= 490; bool get supportsNewUserEndpoints => apiVersion >= 490;
+6
View File
@@ -157,6 +157,10 @@ class InvenTreeSupplierPart extends InvenTreeModel {
fields["active"] = {}; fields["active"] = {};
} }
if (InvenTreeAPI().supportsSupplierPartPrimaryField) {
fields["primary"] = {};
}
return fields; return fields;
} }
@@ -198,6 +202,8 @@ class InvenTreeSupplierPart extends InvenTreeModel {
bool get active => getBool("active", backup: true); bool get active => getBool("active", backup: true);
bool get primary => getBool("primary", backup: false);
int get partId => getInt("part"); int get partId => getInt("part");
double get inStock => getDouble("in_stock"); double get inStock => getDouble("in_stock");
+9
View File
@@ -612,6 +612,12 @@
"filterInProductionDetail": "Show parts in production", "filterInProductionDetail": "Show parts in production",
"@filterInProductionDetail": {}, "@filterInProductionDetail": {},
"filterPrimary": "Primary",
"@filterPrimary": {},
"filterPrimaryDetail": "Show primary supplier parts",
"@filterPrimaryDetail": {},
"filterSerialized": "Serialized", "filterSerialized": "Serialized",
"@filterSerialized": {}, "@filterSerialized": {},
@@ -1136,6 +1142,9 @@
"printLabel": "Print Label", "printLabel": "Print Label",
"@printLabel": {}, "@printLabel": {},
"primary": "Primary",
"@primary": {},
"plugin": "Plugin", "plugin": "Plugin",
"@plugin": {}, "@plugin": {},
@@ -182,6 +182,21 @@ class _SupplierPartDisplayState
); );
} }
if (api.supportsSupplierPartPrimaryField) {
tiles.add(
ListTile(
title: Text(L10().primary),
leading: Icon(TablerIcons.star, color: COLOR_ACTION),
trailing: Text(
widget.supplierPart.primary ? L10().yes : L10().no,
style: widget.supplierPart.primary
? TextStyle(color: COLOR_SUCCESS)
: null,
),
),
);
}
// Stock levels associated with this SupplierPart // Stock levels associated with this SupplierPart
tiles.add( tiles.add(
ListTile( ListTile(
@@ -65,6 +65,14 @@ class _PaginatedSupplierPartListState
}; };
} }
if (InvenTreeAPI().supportsSupplierPartPrimaryField) {
filters["primary"] = {
"label": L10().filterPrimary,
"help_text": L10().filterPrimaryDetail,
"tristate": true,
};
}
return filters; return filters;
} }