-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Description
For code in https://github.com/beancount/beangulp/blob/35fea180ed65dbe9113e1566c88ba34b38d1fcb5/beangulp/similar.py#L221C1-L222C21 which skips interpolated posting.
def amounts_map(entry):
"""Compute a mapping of (account, currency) -> Decimal balances.
Args:
entry: A Transaction instance.
Returns:
A dict of account -> Amount balance.
"""
amounts = collections.defaultdict(Decimal)
for posting in entry.postings:
# Skip interpolated postings.
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):
key = (posting.account, currency)
amounts[key] += posting.units.number
return amountsIf there are some hand write transaction in history like:
2000-01-01 *
Assets:A -100 USD
Expenses:B
And when importer generates something and let smart_importer to predict another posting, the transaction in deduplicate progress would be like:
2000-01-01 *
Expenses:B 100 USD
The heuristic_comparator() will not consider these two transaction as duplicated because the account is not same.
One is {"Assets:A": "-100"}, and another one is {"Expenses:B": "100"}
Metadata
Metadata
Assignees
Labels
No labels