balance_sheet: Sort trial balance accounts.

They were previously sorted by date, then name, which is slightly less
helpful.
This commit is contained in:
Brett Smith 2020-08-18 14:20:16 -04:00
parent 950536e4f1
commit 5c7cf9cd2a
2 changed files with 9 additions and 7 deletions

View file

@ -189,14 +189,16 @@ 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) -> Iterable[data.Account]: def iter_accounts(self, root: str) -> 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
for account in data.Account.iter_accounts(root): return sorted(
meta = account.meta account
if (meta.open_date < stop_date for account in data.Account.iter_accounts(root)
and (meta.close_date is None or meta.close_date > start_date)): if account.meta.open_date < stop_date
yield account and (account.meta.close_date is None
or account.meta.close_date > start_date)
)
class Report(core.BaseODS[Sequence[None], None]): class Report(core.BaseODS[Sequence[None], None]):

View file

@ -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.8.2', version='1.8.3',
author='Software Freedom Conservancy', author='Software Freedom Conservancy',
author_email='info@sfconservancy.org', author_email='info@sfconservancy.org',
license='GNU AGPLv3+', license='GNU AGPLv3+',