Skip to content

Commit

Permalink
fix: one-file-per-account broke with smart_importer #97
Browse files Browse the repository at this point in the history
  • Loading branch information
redstreet committed Apr 4, 2024
1 parent e94b3f1 commit 2149793
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 21 deletions.
3 changes: 0 additions & 3 deletions beancount_reds_importers/importers/workday/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,3 @@ def valid_header_label(label):
for header in table.header():
table = table.rename(header, valid_header_label(header))
self.alltables[section] = table

def build_metadata(self, file, metatype=None, data={}):
return {"filing_account": self.config["main_account"]}
6 changes: 0 additions & 6 deletions beancount_reds_importers/libtransactionbuilder/banking.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ def build_account_map(self):
# }
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.)
and the data dictionary to return additional metadata"""
return {}

def match_account_number(self, file_account, config_account):
return file_account.endswith(config_account)

Expand Down
6 changes: 0 additions & 6 deletions beancount_reds_importers/libtransactionbuilder/investments.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,6 @@ def build_account_map(self):
)
# fmt: on

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.)
and the data dictionary to return additional metadata"""
return {}

def custom_init(self):
if not self.custom_init_run:
self.max_rounding_error = 0.04
Expand Down
6 changes: 0 additions & 6 deletions beancount_reds_importers/libtransactionbuilder/paycheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,6 @@ def build_postings(self, entry):
newentry = entry._replace(postings=postings)
return newentry

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.)
and the data dictionary to return additional metadata"""
return {}

def extract(self, file, existing_entries=None):
self.initialize(file)
config = self.config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,14 @@ def set_config_variables(self, substs):
self.config["filing_account"] = self.remove_empty_subaccounts(
filing_account
)

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.)
and the data dictionary to return additional metadata"""

# This 'filing_account' is read by a patch to bean-extract so it can output transactions to
# a file that corresponds with filing_account, when the one-file-per-account feature is
# used.
acct = self.config.get('filing_account', self.config.get('main_account', None))
return {"filing_account": acct}

0 comments on commit 2149793

Please sign in to comment.