2
0
mirror of https://github.com/inventree/inventree-app.git synced 2026-01-29 01:03:40 +00:00

Support logical and custom status fields for models (#758)

* Support logical and custom status fields for models

* Update release notes
This commit is contained in:
Oliver
2026-01-22 23:35:09 +11:00
committed by GitHub
parent 772c88170e
commit c5bf4be3d1
4 changed files with 19 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
### x.xx.x - Month Year ### x.xx.x - Month Year
--- ---
- Support display of custom status codes
- Fix default values for list sorting - Fix default values for list sorting

View File

@@ -334,6 +334,24 @@ class InvenTreeModel {
String get description => getString("description"); String get description => getString("description");
int get logicalStatus => getInt("status");
int get customStatus => getInt("status_custom_key");
// Return the effective status of this object
// If a custom status is defined, return that, otherwise return the logical status
int get status {
if (customStatus > 0) {
return customStatus;
} else {
return logicalStatus;
}
}
String get statusText => getString("status_text");
bool get hasCustomStatus => customStatus > 0 && customStatus != status;
String get notes => getString("notes"); String get notes => getString("notes");
int get parentId => getInt("parent"); int get parentId => getInt("parent");

View File

@@ -57,10 +57,6 @@ class InvenTreeOrder extends InvenTreeModel {
bool get hasProjectCode => projectCode.isNotEmpty; bool get hasProjectCode => projectCode.isNotEmpty;
int get status => getInt("status");
String get statusText => getString("status_text");
double? get totalPrice { double? get totalPrice {
String price = getString("total_price"); String price = getString("total_price");

View File

@@ -256,8 +256,6 @@ class InvenTreeStockItem extends InvenTreeModel {
}); });
} }
int get status => getInt("status");
bool get isInStock => getBool("in_stock", backup: true); bool get isInStock => getBool("in_stock", backup: true);
String get packaging => getString("packaging"); String get packaging => getString("packaging");