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
|
|
@ -359,6 +359,10 @@ class InvenTreeStockItem extends InvenTreeModel {
|
|||
return sname;
|
||||
}
|
||||
|
||||
String get units {
|
||||
return jsondata['part_detail']?['units'] ?? '';
|
||||
}
|
||||
|
||||
String get supplierSKU {
|
||||
String sku = '';
|
||||
|
||||
|
|
@ -375,11 +379,18 @@ class InvenTreeStockItem extends InvenTreeModel {
|
|||
|
||||
String get quantityString {
|
||||
|
||||
String q = quantity.toString();
|
||||
|
||||
// Simplify integer values e.g. "1.0" becomes "1"
|
||||
if (quantity.toInt() == quantity) {
|
||||
return quantity.toInt().toString();
|
||||
} else {
|
||||
return quantity.toString();
|
||||
q = quantity.toInt().toString();
|
||||
}
|
||||
|
||||
if (units.isNotEmpty) {
|
||||
q += " ${units}";
|
||||
}
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
int get locationId => (jsondata['location'] ?? -1) as int;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue