mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 03:26:24 +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
3 changed files with 32 additions and 6 deletions
|
|
@ -142,6 +142,8 @@ class InvenTreePart extends InvenTreeModel {
|
|||
"category": {
|
||||
},
|
||||
|
||||
"units": {},
|
||||
|
||||
// Checkbox fields
|
||||
"active": {},
|
||||
"assembly": {},
|
||||
|
|
@ -256,13 +258,21 @@ class InvenTreePart extends InvenTreeModel {
|
|||
|
||||
String get inStockString {
|
||||
|
||||
String q = inStock.toString();
|
||||
|
||||
if (inStock == inStock.toInt()) {
|
||||
return inStock.toInt().toString();
|
||||
} else {
|
||||
return inStock.toString();
|
||||
q = inStock.toInt().toString();
|
||||
}
|
||||
|
||||
if (units.isNotEmpty) {
|
||||
q += " ${units}";
|
||||
}
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
String get units => jsondata["units"] ?? "";
|
||||
|
||||
// Get the number of units being build for this Part
|
||||
double get building => double.tryParse(jsondata['building'].toString()) ?? 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue