balance_sheet: Add account code column to chart of accounts.
This commit is contained in:
parent
5081c8934c
commit
2c3438ba0f
2 changed files with 8 additions and 2 deletions
|
@ -198,7 +198,7 @@ class Balances:
|
||||||
return prefix, -max_bal
|
return prefix, -max_bal
|
||||||
return sorted(class_bals, key=sortkey)
|
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
|
start_date = self.period_range.start
|
||||||
stop_date = self.period_range.stop
|
stop_date = self.period_range.stop
|
||||||
return sorted(
|
return sorted(
|
||||||
|
@ -573,6 +573,7 @@ class Report(core.BaseODS[Sequence[None], None]):
|
||||||
"Trial Balances",
|
"Trial Balances",
|
||||||
["Account Name"],
|
["Account Name"],
|
||||||
["Classification"],
|
["Classification"],
|
||||||
|
["Account Code"],
|
||||||
["Balance Beginning", self.balances.period_range.start.strftime(self.date_fmt)],
|
["Balance Beginning", self.balances.period_range.start.strftime(self.date_fmt)],
|
||||||
totals_prefix=["Change During", f"{self.period_desc} Ending"],
|
totals_prefix=["Change During", f"{self.period_desc} Ending"],
|
||||||
title_fmt="Chart of Accounts with DRAFT {sheet_name}",
|
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],
|
["Balance Ending", self.period_name],
|
||||||
stylename=header_row.lastChild.getAttribute('stylename'),
|
stylename=header_row.lastChild.getAttribute('stylename'),
|
||||||
), header_row.lastChild)
|
), 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']:
|
for acct_root in ['Assets', 'Liabilities', 'Income', 'Expenses', 'Equity']:
|
||||||
norm_func = core.normalize_amount_func(f'{acct_root}:Dummy')
|
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.add_row(
|
||||||
self.string_cell(account),
|
self.string_cell(account),
|
||||||
self.string_cell(account.meta.get('classification', '')),
|
self.string_cell(account.meta.get('classification', '')),
|
||||||
|
self.string_cell(account.meta.get('account-code', '')),
|
||||||
open_cell,
|
open_cell,
|
||||||
self.balance_cell(norm_func(period_bal)),
|
self.balance_cell(norm_func(period_bal)),
|
||||||
close_cell,
|
close_cell,
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -5,7 +5,7 @@ from setuptools import setup
|
||||||
setup(
|
setup(
|
||||||
name='conservancy_beancount',
|
name='conservancy_beancount',
|
||||||
description="Plugin, library, and reports for reading Conservancy's books",
|
description="Plugin, library, and reports for reading Conservancy's books",
|
||||||
version='1.9.4',
|
version='1.9.5',
|
||||||
author='Software Freedom Conservancy',
|
author='Software Freedom Conservancy',
|
||||||
author_email='info@sfconservancy.org',
|
author_email='info@sfconservancy.org',
|
||||||
license='GNU AGPLv3+',
|
license='GNU AGPLv3+',
|
||||||
|
|
Loading…
Reference in a new issue