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:
@@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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");
|
||||||
|
|||||||
@@ -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");
|
||||||
|
|
||||||
|
|||||||
@@ -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");
|
||||||
|
|||||||
Reference in New Issue
Block a user