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
This commit is contained in:
RunasSudo 2020-03-23 20:23:31 +11:00
parent 79305f8a8f
commit fe600592d6
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
2 changed files with 2 additions and 2 deletions

View File

@ -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:

View File

@ -22,7 +22,7 @@
{% block links %}
{{ super() }}
<a href="/transactions_commodity?{{ {'date': date.strftime('%Y-%m-%d'), 'pstart': pstart.strftime('%Y-%m-%d'), 'account': account.name, 'cash': 'on' if cash else ''}|urlencode }}">Show commodity detail</a>
{% if account %}<a href="/transactions_commodity?{{ {'date': date.strftime('%Y-%m-%d'), 'pstart': pstart.strftime('%Y-%m-%d'), 'account': account.name, 'cash': 'on' if cash else ''}|urlencode }}">Show commodity detail</a>{% endif %}
{% endblock %}
{% block report %}