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
+3
View File
@@ -326,6 +326,9 @@ class InvenTreeAPI {
// Ref: https://github.com/inventree/InvenTree/pull/10699
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?
// Ref: https://github.com/inventree/InvenTree/pull/11963
bool get supportsNewUserEndpoints => apiVersion >= 490;
+6
View File
@@ -157,6 +157,10 @@ class InvenTreeSupplierPart extends InvenTreeModel {
fields["active"] = {};
}
if (InvenTreeAPI().supportsSupplierPartPrimaryField) {
fields["primary"] = {};
}
return fields;
}
@@ -198,6 +202,8 @@ class InvenTreeSupplierPart extends InvenTreeModel {
bool get active => getBool("active", backup: true);
bool get primary => getBool("primary", backup: false);
int get partId => getInt("part");
double get inStock => getDouble("in_stock");
+9
View File
@@ -612,6 +612,12 @@
"filterInProductionDetail": "Show parts in production",
"@filterInProductionDetail": {},
"filterPrimary": "Primary",
"@filterPrimary": {},
"filterPrimaryDetail": "Show primary supplier parts",
"@filterPrimaryDetail": {},
"filterSerialized": "Serialized",
"@filterSerialized": {},
@@ -1136,6 +1142,9 @@
"printLabel": "Print Label",
"@printLabel": {},
"primary": "Primary",
"@primary": {},
"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
tiles.add(
ListTile(
@@ -65,6 +65,14 @@ class _PaginatedSupplierPartListState
};
}
if (InvenTreeAPI().supportsSupplierPartPrimaryField) {
filters["primary"] = {
"label": L10().filterPrimary,
"help_text": L10().filterPrimaryDetail,
"tristate": true,
};
}
return filters;
}