diff --git a/beancount_reds_importers/importers/workday/__init__.py b/beancount_reds_importers/importers/workday/__init__.py index ff06c3f..e8c4261 100644 --- a/beancount_reds_importers/importers/workday/__init__.py +++ b/beancount_reds_importers/importers/workday/__init__.py @@ -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"]} diff --git a/beancount_reds_importers/libtransactionbuilder/banking.py b/beancount_reds_importers/libtransactionbuilder/banking.py index abddbca..b4816b9 100644 --- a/beancount_reds_importers/libtransactionbuilder/banking.py +++ b/beancount_reds_importers/libtransactionbuilder/banking.py @@ -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) diff --git a/beancount_reds_importers/libtransactionbuilder/investments.py b/beancount_reds_importers/libtransactionbuilder/investments.py index 7dca20d..d66d7b5 100644 --- a/beancount_reds_importers/libtransactionbuilder/investments.py +++ b/beancount_reds_importers/libtransactionbuilder/investments.py @@ -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 diff --git a/beancount_reds_importers/libtransactionbuilder/paycheck.py b/beancount_reds_importers/libtransactionbuilder/paycheck.py index b487b07..a7f26ea 100644 --- a/beancount_reds_importers/libtransactionbuilder/paycheck.py +++ b/beancount_reds_importers/libtransactionbuilder/paycheck.py @@ -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 diff --git a/beancount_reds_importers/libtransactionbuilder/transactionbuilder.py b/beancount_reds_importers/libtransactionbuilder/transactionbuilder.py index f789e9b..31579a2 100644 --- a/beancount_reds_importers/libtransactionbuilder/transactionbuilder.py +++ b/beancount_reds_importers/libtransactionbuilder/transactionbuilder.py @@ -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}