diff --git a/ledger_pyreport/jinja2/transactions_commodity.html b/ledger_pyreport/jinja2/transactions_commodity.html
index 9e5c802..c8f08ce 100644
--- a/ledger_pyreport/jinja2/transactions_commodity.html
+++ b/ledger_pyreport/jinja2/transactions_commodity.html
@@ -100,6 +100,18 @@
{% endfor %}
+ {% for amount in closing_balance.strip_prices().amounts %}
+
+ |
+ |
+ |
+ |
+ |
+ {{ amount|abs|bt(True) }}
+ {% if amount >= 0 %}Dr{% else %}Cr{% endif %} |
+
+ {% endfor %}
+
|
|
diff --git a/ledger_pyreport/model.py b/ledger_pyreport/model.py
index 06183c4..838c536 100644
--- a/ledger_pyreport/model.py
+++ b/ledger_pyreport/model.py
@@ -271,10 +271,14 @@ class Balance:
def __init__(self, amounts=None):
self.amounts = amounts or []
- def tidy(self):
+ def strip_prices(self):
new_amounts = []
for amount in self.amounts:
- new_amount = next((a for a in new_amounts if a.commodity == amount.commodity), None)
+ new_amount = next((a for a in new_amounts if a.commodity.name == amount.commodity.name), None)
+ if new_amount is None:
+ new_amounts.append(Amount(amount.amount, amount.commodity.strip_price()))
+ else:
+ new_amount.amount += amount.amount
return Balance(new_amounts)
def clean(self):