mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 13:36:50 +00:00
Add "units" for part
- Edit "units" for a part - Display "units" after stock quantity
This commit is contained in:
parent
157109e164
commit
f6302bd65d
@ -1,6 +1,11 @@
|
|||||||
## InvenTree App Release Notes
|
## InvenTree App Release Notes
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### 0.4.7 - September 2021
|
||||||
|
---
|
||||||
|
|
||||||
|
- Display units after stock quantity
|
||||||
|
|
||||||
### 0.4.6 - August 2021
|
### 0.4.6 - August 2021
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -142,6 +142,8 @@ class InvenTreePart extends InvenTreeModel {
|
|||||||
"category": {
|
"category": {
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"units": {},
|
||||||
|
|
||||||
// Checkbox fields
|
// Checkbox fields
|
||||||
"active": {},
|
"active": {},
|
||||||
"assembly": {},
|
"assembly": {},
|
||||||
@ -256,13 +258,21 @@ class InvenTreePart extends InvenTreeModel {
|
|||||||
|
|
||||||
String get inStockString {
|
String get inStockString {
|
||||||
|
|
||||||
|
String q = inStock.toString();
|
||||||
|
|
||||||
if (inStock == inStock.toInt()) {
|
if (inStock == inStock.toInt()) {
|
||||||
return inStock.toInt().toString();
|
q = inStock.toInt().toString();
|
||||||
} else {
|
|
||||||
return inStock.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (units.isNotEmpty) {
|
||||||
|
q += " ${units}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return q;
|
||||||
|
}
|
||||||
|
|
||||||
|
String get units => jsondata["units"] ?? "";
|
||||||
|
|
||||||
// Get the number of units being build for this Part
|
// Get the number of units being build for this Part
|
||||||
double get building => double.tryParse(jsondata['building'].toString()) ?? 0;
|
double get building => double.tryParse(jsondata['building'].toString()) ?? 0;
|
||||||
|
|
||||||
|
@ -359,6 +359,10 @@ class InvenTreeStockItem extends InvenTreeModel {
|
|||||||
return sname;
|
return sname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String get units {
|
||||||
|
return jsondata['part_detail']?['units'] ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
String get supplierSKU {
|
String get supplierSKU {
|
||||||
String sku = '';
|
String sku = '';
|
||||||
|
|
||||||
@ -375,11 +379,18 @@ class InvenTreeStockItem extends InvenTreeModel {
|
|||||||
|
|
||||||
String get quantityString {
|
String get quantityString {
|
||||||
|
|
||||||
|
String q = quantity.toString();
|
||||||
|
|
||||||
|
// Simplify integer values e.g. "1.0" becomes "1"
|
||||||
if (quantity.toInt() == quantity) {
|
if (quantity.toInt() == quantity) {
|
||||||
return quantity.toInt().toString();
|
q = quantity.toInt().toString();
|
||||||
} else {
|
|
||||||
return quantity.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (units.isNotEmpty) {
|
||||||
|
q += " ${units}";
|
||||||
|
}
|
||||||
|
|
||||||
|
return q;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get locationId => (jsondata['location'] ?? -1) as int;
|
int get locationId => (jsondata['location'] ?? -1) as int;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user