Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore entries without amount in amount_map #99

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion beangulp/similar.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from beancount.core.number import D
from beancount.core.number import ZERO
from beancount.core.number import ONE
from beancount.core.number import MISSING
from beancount.core import data
from beancount.core import amount
from beancount.core import interpolate
Expand Down Expand Up @@ -145,7 +146,7 @@ def amounts_map(entry):
if posting.meta and interpolate.AUTOMATIC_META in posting.meta:
continue
currency = isinstance(posting.units, amount.Amount) and posting.units.currency
if isinstance(currency, str):
if isinstance(currency, str) and posting.units.number != MISSING:
key = (posting.account, currency)
amounts[key] += posting.units.number
return amounts
1 change: 1 addition & 0 deletions beangulp/similar_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def test_amounts_map(self, entries, _, __):
2016-01-03 *
Expenses:Tips 1.01 USD
Expenses:Tips 1.02 USD
Expenses:Tips USD @ 1.1 CHF
Assets:Other
"""
txns = list(data.filter_txns(entries))
Expand Down