From fe600592d613cc695adf13850dbe58602321d402 Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Mon, 23 Mar 2020 20:23:31 +1100 Subject: [PATCH] Fix typo/bug in cash calculations involving asset accounts Typo resulted e.g. in transactions between cash assets and liabilities being discarded instead of being charged to Other Income --- ledger_pyreport/accounting.py | 2 +- ledger_pyreport/jinja2/transactions.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ledger_pyreport/accounting.py b/ledger_pyreport/accounting.py index 4aa335a..e02364c 100644 --- a/ledger_pyreport/accounting.py +++ b/ledger_pyreport/accounting.py @@ -113,7 +113,7 @@ def account_to_cash(account, currency): balancing_posting.transaction.postings.remove(balancing_posting) if amount_remaining != 0: - if account.is_asset: + if posting.account.is_asset: # Cash - charge any unbalanced remainder to Other Income posting.transaction.postings.append(Posting(posting.transaction, account.ledger.get_account(config['cash_other_income']), Amount(-amount_remaining, currency))) else: diff --git a/ledger_pyreport/jinja2/transactions.html b/ledger_pyreport/jinja2/transactions.html index 01a991c..92126b2 100644 --- a/ledger_pyreport/jinja2/transactions.html +++ b/ledger_pyreport/jinja2/transactions.html @@ -22,7 +22,7 @@ {% block links %} {{ super() }} - Show commodity detail + {% if account %}Show commodity detail{% endif %} {% endblock %} {% block report %}