Skip to content

Commit

Permalink
Don't fail on transactions with no opposing splits
Browse files Browse the repository at this point in the history
I saw a transaction like this that had an amount of $0.00.
  • Loading branch information
nylen committed Nov 20, 2015
1 parent b4e21bf commit 2ff14e6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
5 changes: 4 additions & 1 deletion gnucash_data/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,10 @@ def opposing_split_set(self):

@property
def opposing_split(self):
return self.opposing_split_set[0]
try:
return self.opposing_split_set[0]
except:
return None

@property
def opposing_account(self):
Expand Down
14 changes: 9 additions & 5 deletions money_templates/templates/page_account_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,17 @@
<i class="icon-filter"></i>
</a>
{% endif %}
<a class="opposing-account-name" title="Go to account '{{ split.opposing_account.path }}'"
href="{% url money_views.views.account split.opposing_account.webapp_key %}">
{% if split.opposing_account %}
<a class="opposing-account-name" title="Go to account '{{ split.opposing_account.path }}'"
href="{% url money_views.views.account split.opposing_account.webapp_key %}">

{{ split.opposing_account.description_or_name }}</a>
{{ split.opposing_account.description_or_name }}</a>

<i class="change-opposing-account icon-caret-down" data-value="{{ split.opposing_account.guid }}"
title="Change opposing account"></i>
<i class="change-opposing-account icon-caret-down" data-value="{{ split.opposing_account.guid }}"
title="Change opposing account"></i>
{% else %}
No opposing account
{% endif %}
</td>
<td class="amount {% if split.is_credit %}credit{% else %}debit{% endif %}"
data-value="{{ split.amount }}">
Expand Down

0 comments on commit 2ff14e6

Please sign in to comment.