From 33e065fb51446cad051c2fe2c2f855064767af0b Mon Sep 17 00:00:00 2001 From: Red S Date: Wed, 3 Apr 2024 19:15:19 -0700 Subject: [PATCH] fix: only emit filing account metadata if configured #97 --- importers/workday/__init__.py | 4 ++++ libtransactionbuilder/transactionbuilder.py | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/importers/workday/__init__.py b/importers/workday/__init__.py index e8c4261..2a1f08b 100644 --- a/importers/workday/__init__.py +++ b/importers/workday/__init__.py @@ -50,3 +50,7 @@ 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={}): + acct = self.config.get("filing_account", self.config.get("main_account", None)) + return {"filing_account": acct} diff --git a/libtransactionbuilder/transactionbuilder.py b/libtransactionbuilder/transactionbuilder.py index 07694eb..c0082ec 100644 --- a/libtransactionbuilder/transactionbuilder.py +++ b/libtransactionbuilder/transactionbuilder.py @@ -53,5 +53,9 @@ def build_metadata(self, file, metatype=None, data={}): # 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} + if self.config.get("emit_filing_account_metadata"): + acct = self.config.get( + "filing_account", self.config.get("main_account", None) + ) + return {"filing_account": acct} + return {}