2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-17 04:35:26 +00:00

Further improvements for stock view

This commit is contained in:
Oliver Walters
2020-04-06 22:13:57 +10:00
parent 5e3793b3ba
commit 948c9c1d23
3 changed files with 155 additions and 4 deletions

View File

@ -15,6 +15,7 @@ class InvenTreeStockItem extends InvenTreeModel {
headers["part_detail"] = "true";
headers["location_detail"] = "true";
headers["supplier_detail"] = "true";
return headers;
}
@ -25,6 +26,10 @@ class InvenTreeStockItem extends InvenTreeModel {
// TODO
}
int get partId => jsondata['part'] ?? -1;
int get trackingItemCount => jsondata['tracking_items'] as int ?? 0;
String get partName {
String nm = '';
@ -78,12 +83,58 @@ class InvenTreeStockItem extends InvenTreeModel {
return thumb;
}
int get supplierPartId => jsondata['supplier_part'] as int ?? -1;
String get supplierImage {
String thumb = '';
if (jsondata.containsKey("supplier_detail")) {
thumb = jsondata['supplier_detail']['supplier_logo'] ?? '';
}
return thumb;
}
String get supplierName {
String sname = '';
if (jsondata.containsKey("supplier_detail")) {
sname = jsondata["supplier_detail"]["supplier_name"] ?? '';
}
return sname;
}
String get supplierSKU {
String sku = '';
if (jsondata.containsKey("supplier_detail")) {
sku = jsondata["supplier_detail"]["SKU"] ?? '';
}
return sku;
}
int get serialNumber => jsondata['serial'] as int ?? null;
double get quantity => jsondata['quantity'] as double ?? 0.0;
double get quantity => double.tryParse(jsondata['quantity'].toString() ?? '0');
int get locationId => jsondata['location'] as int ?? -1;
String get locationName {
String loc = '';
if (jsondata.containsKey('location_detail')) {
loc = jsondata['location_detail']['name'] ?? '';
}
if (loc.isEmpty) {
loc = jsondata['location__name'] ?? '';
}
return loc;
}
String get displayQuantity {
// Display either quantity or serial number!