Display line items in purchase order view

This commit is contained in:
Oliver 2021-09-28 11:43:56 +10:00
parent cca56299f8
commit 54d8c1759c
5 changed files with 109 additions and 12 deletions

View file

@ -52,7 +52,7 @@ class InvenTreePurchaseOrder extends InvenTreeModel {
String get targetDate => jsondata['target_date'] ?? "";
int get lineItems => jsondata['line_items'] ?? 0;
int get lineItemCount => jsondata['line_items'] ?? 0;
bool get overdue => jsondata['overdue'] ?? false;
@ -144,10 +144,14 @@ class InvenTreePOLineItem extends InvenTreeModel {
};
}
bool get isComplete => received >= quantity;
double get quantity => jsondata['quantity'] ?? 0;
double get received => jsondata['received'] ?? 0;
double get outstanding => quantity - received;
String get reference => jsondata['reference'] ?? "";
int get orderId => jsondata['order'] ?? -1;
@ -164,6 +168,17 @@ class InvenTreePOLineItem extends InvenTreeModel {
}
}
InvenTreeSupplierPart? get supplierPart {
dynamic detail = jsondata["supplier_part_detail"] ?? null;
if (detail == null) {
return null;
} else {
return InvenTreeSupplierPart.fromJson(detail);
}
}
double get purchasePrice => double.parse(jsondata['purchase_price']);
String get purchasePriceCurrency => jsondata['purchase_price_currency'] ?? "";