diff --git a/assets/release_notes.md b/assets/release_notes.md index a8a0f6b6..19b51b99 100644 --- a/assets/release_notes.md +++ b/assets/release_notes.md @@ -9,6 +9,7 @@ - Improvements for PartCategory editing form - Improvements for StockLocation editing form - Adds ability to edit StockItem +- Display purchase price (where available) for StockItem - Updated translations ### 0.2.10 - July 2021 diff --git a/lib/inventree/stock.dart b/lib/inventree/stock.dart index cb1a524b..efe48546 100644 --- a/lib/inventree/stock.dart +++ b/lib/inventree/stock.dart @@ -60,6 +60,8 @@ class InvenTreeStockItem extends InvenTreeModel { String statusLabel(BuildContext context) { + // TODO: Delete me - The translated status values are provided by the API! + switch (status) { case OK: return L10().ok; @@ -220,6 +222,15 @@ class InvenTreeStockItem extends InvenTreeModel { int get partId => jsondata['part'] ?? -1; + String get purchasePrice => jsondata['purchase_price']; + + bool get hasPurchasePrice { + + String pp = purchasePrice; + + return pp.isNotEmpty && pp.trim() != "-"; + } + int get trackingItemCount => (jsondata['tracking_items'] ?? 0) as int; // Date of last update diff --git a/lib/l10n b/lib/l10n index 4dccf7c3..46d08c9c 160000 --- a/lib/l10n +++ b/lib/l10n @@ -1 +1 @@ -Subproject commit 4dccf7c37fe5bca94fe0ef9ab05f7d5f0ec52452 +Subproject commit 46d08c9cc0043113fee5c0d134861c5d12554b71 diff --git a/lib/widget/stock_detail.dart b/lib/widget/stock_detail.dart index 9d1e0ac0..c71335c4 100644 --- a/lib/widget/stock_detail.dart +++ b/lib/widget/stock_detail.dart @@ -534,6 +534,18 @@ class _StockItemDisplayState extends RefreshableState { ); } + if (item.hasPurchasePrice) { + tiles.add( + ListTile( + title: Text(L10().purchasePrice), + leading: FaIcon(FontAwesomeIcons.dollarSign), + trailing: Text(item.purchasePrice), + ) + ); + } + + // TODO - Is this stock item linked to a PurchaseOrder? + // TODO - Re-enable stock item history display if (false && item.trackingItemCount > 0) { tiles.add(