From 297b2bf451c505ab7d9086bb2606296179afc18d Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Sat, 2 Jan 2021 21:28:20 +1100 Subject: [PATCH] Bug fixes Correct incorrect URL on cash flow report Force sort transactions by date --- ledger_pyreport/jinja2/cashflow_direct.html | 2 +- ledger_pyreport/ledger.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ledger_pyreport/jinja2/cashflow_direct.html b/ledger_pyreport/jinja2/cashflow_direct.html index 172f0c2..a7603a3 100644 --- a/ledger_pyreport/jinja2/cashflow_direct.html +++ b/ledger_pyreport/jinja2/cashflow_direct.html @@ -29,7 +29,7 @@ {% for cashflow in cashflows %} {% set amount = (-cashflow.get_balance(account) if invert else cashflow.get_balance(account)).exchange(report_commodity, True) %} - {% if not amount.near_zero %}{{ amount|a('/transactions?' + {'date': cashflow.date.strftime('%Y-%m-%d'), 'pstart': cashflow.pstart.strftime('%Y-%m-%d'), 'account': account.name, 'cash': 'on' if cash else ''}|urlencode) }}{% endif %} + {% if not amount.near_zero %}{{ amount|a('/transactions?' + {'date_end': cashflow.date.strftime('%Y-%m-%d'), 'date_beg': cashflow.pstart.strftime('%Y-%m-%d'), 'account': account.name, 'cash': 'on' if cash else ''}|urlencode) }}{% endif %} {% endfor %} diff --git a/ledger_pyreport/ledger.py b/ledger_pyreport/ledger.py index 92fb531..4305442 100644 --- a/ledger_pyreport/ledger.py +++ b/ledger_pyreport/ledger.py @@ -131,4 +131,6 @@ def raw_transactions_at_date(date): if amount.commodity.name not in ledger.commodities: ledger.commodities[amount.commodity.name] = amount.commodity.strip_price() + ledger.transactions.sort(key=lambda t: t.date) + return ledger