mirror of
https://github.com/inventree/inventree-app.git
synced 2026-09-08 19:00:14 +00:00
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:
@@ -1,6 +1,7 @@
|
||||
## 0.xx.y - August 2026
|
||||
---
|
||||
|
||||
- Additional filtering options for supplier parts
|
||||
- Additional barcode support using data intents
|
||||
- Improvements for build order display
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user