diff --git a/conservancy_beancount/reports/balance_sheet.py b/conservancy_beancount/reports/balance_sheet.py index d02fe4227f39df6a14bc5b97e9f620926038c9a4..14a5cafe0c93c225d8205df3850e3592afba3b08 100644 --- a/conservancy_beancount/reports/balance_sheet.py +++ b/conservancy_beancount/reports/balance_sheet.py @@ -198,7 +198,7 @@ class Balances: return prefix, -max_bal return sorted(class_bals, key=sortkey) - def iter_accounts(self, root: str) -> Sequence[data.Account]: + def iter_accounts(self, root: Optional[str]=None) -> Sequence[data.Account]: start_date = self.period_range.start stop_date = self.period_range.stop return sorted( @@ -573,6 +573,7 @@ class Report(core.BaseODS[Sequence[None], None]): "Trial Balances", ["Account Name"], ["Classification"], + ["Account Code"], ["Balance Beginning", self.balances.period_range.start.strftime(self.date_fmt)], totals_prefix=["Change During", f"{self.period_desc} Ending"], title_fmt="Chart of Accounts with DRAFT {sheet_name}", @@ -588,6 +589,10 @@ class Report(core.BaseODS[Sequence[None], None]): ["Balance Ending", self.period_name], stylename=header_row.lastChild.getAttribute('stylename'), ), header_row.lastChild) + # Hide account code if it's not ready. + # FIXME: This code can be removed once codes are fully established. + if not any(acct.meta.get('account-code') for acct in self.balances.iter_accounts()): + self.sheet.childNodes[2].setAttribute('visibility', 'collapse') for acct_root in ['Assets', 'Liabilities', 'Income', 'Expenses', 'Equity']: norm_func = core.normalize_amount_func(f'{acct_root}:Dummy') @@ -606,6 +611,7 @@ class Report(core.BaseODS[Sequence[None], None]): self.add_row( self.string_cell(account), self.string_cell(account.meta.get('classification', '')), + self.string_cell(account.meta.get('account-code', '')), open_cell, self.balance_cell(norm_func(period_bal)), close_cell, diff --git a/setup.py b/setup.py index f6ed1d696a5a70de1d5488a2e9d656f88a0fc85e..ce21f101b8e4586cf18cb5917a881cc35d0a81df 100755 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ from setuptools import setup setup( name='conservancy_beancount', description="Plugin, library, and reports for reading Conservancy's books", - version='1.9.4', + version='1.9.5', author='Software Freedom Conservancy', author_email='info@sfconservancy.org', license='GNU AGPLv3+',