Skip to content

Commit

Permalink
feat: add_custom_postings to banking.py
Browse files Browse the repository at this point in the history
  • Loading branch information
redstreet committed Apr 7, 2024
1 parent 246427f commit 0db8f8e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions beancount_reds_importers/libtransactionbuilder/banking.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def extract(self, file, existing_entries=None):
if target_acct:
data.create_simple_posting(entry, target_acct, None, None)

self.add_custom_postings(entry, ot)
new_entries.append(entry)

new_entries += self.extract_balance(file, counter)
Expand Down
3 changes: 0 additions & 3 deletions beancount_reds_importers/libtransactionbuilder/investments.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,6 @@ def add_fee_postings(self, entry, ot):
if getattr(ot, "commission", 0) != 0:
data.create_simple_posting(entry, config["fees"], ot.commission, self.currency)

def add_custom_postings(self, entry, ot):
pass

def extract_custom_entries(self, file, counter):
"""For custom importers to override"""
return []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def set_config_variables(self, substs):
filing_account = self.config["main_account"].format(**kwargs)
self.config["filing_account"] = self.remove_empty_subaccounts(filing_account)

def add_custom_postings(self, entry, ot):
"""This method is for importers to override. Add arbitrary posting to each entry."""
pass

def build_metadata(self, file, metatype=None, data={}):
"""This method is for importers to override. The overridden method can
look at the metatype ('transaction', 'balance', 'account', 'commodity', etc.)
Expand Down

0 comments on commit 0db8f8e

Please sign in to comment.