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

View file

@ -5,7 +5,7 @@ from setuptools import setup
setup(
name='conservancy_beancount',
description="Plugin, library, and reports for reading Conservancy's books",
version='1.8.2',
version='1.8.3',
author='Software Freedom Conservancy',
author_email='info@sfconservancy.org',
license='GNU AGPLv3+',