Adds support for currency display (#277)

* Adds a helper function for rendering currency data

* Update helper functions for StockItem model

* Render purchasePrice correctly for stockitem

* Use currency_formatter library instead of money_formatter

* Add total price display for purchase order

* icon fix
This commit is contained in:
Oliver 2023-03-08 23:42:26 +11:00 committed by GitHub
parent 221920cbbe
commit 347e80d8e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 311 additions and 236 deletions

View file

@ -89,6 +89,18 @@ class InvenTreePurchaseOrder extends InvenTreeModel {
bool get isFailed => status == PO_STATUS_CANCELLED || status == PO_STATUS_LOST || status == PO_STATUS_RETURNED;
double? get totalPrice {
String price = (jsondata["total_price"] ?? "") as String;
if (price.isEmpty) {
return null;
} else {
return double.tryParse(price);
}
}
String get totalPriceCurrency => (jsondata["total_price_currency"] ?? "") as String;
Future<List<InvenTreePOLineItem>> getLineItems() async {
final results = await InvenTreePOLineItem().list(