reports: Add common properties to all ODS reports.
This commit is contained in:
parent
837fcec8f0
commit
f56d89462a
5 changed files with 8 additions and 2 deletions
|
@ -756,13 +756,14 @@ def main(arglist: Optional[Sequence[str]]=None,
|
|||
if rt_wrapper is None:
|
||||
logger.error("unable to generate aging report: RT client is required")
|
||||
else:
|
||||
now = datetime.datetime.now()
|
||||
if args.output_file is None:
|
||||
now = datetime.datetime.now()
|
||||
out_dir_path = config.repository_path() or Path()
|
||||
args.output_file = out_dir_path / now.strftime('AgingReport_%Y-%m-%d_%H:%M.ods')
|
||||
logger.info("Writing report to %s", args.output_file)
|
||||
out_bin = cliutil.bytes_output(args.output_file, stdout)
|
||||
report = AgingReport(rt_wrapper, out_bin)
|
||||
report.ods.set_common_properties(config.books_repo())
|
||||
elif args.report_type is ReportType.OUTGOING:
|
||||
rt_wrapper = config.rt_wrapper()
|
||||
if rt_wrapper is None:
|
||||
|
|
|
@ -394,6 +394,7 @@ def main(arglist: Optional[Sequence[str]]=None,
|
|||
report.write(fund_map.items())
|
||||
else:
|
||||
ods_report = ODSReport(args.start_date, args.stop_date)
|
||||
ods_report.set_common_properties(config.books_repo())
|
||||
ods_report.write(fund_map.items())
|
||||
if args.output_file is None:
|
||||
out_dir_path = config.repository_path() or Path()
|
||||
|
|
|
@ -809,6 +809,7 @@ def main(arglist: Optional[Sequence[str]]=None,
|
|||
except ValueError as error:
|
||||
logger.error("%s: %r", *error.args)
|
||||
return 2
|
||||
report.set_common_properties(config.books_repo())
|
||||
report.write(postings)
|
||||
if not any(report.account_groups.values()):
|
||||
logger.warning("no matching postings found to report")
|
||||
|
|
2
setup.py
2
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.6.2',
|
||||
version='1.6.3',
|
||||
author='Software Freedom Conservancy',
|
||||
author_email='info@sfconservancy.org',
|
||||
license='GNU AGPLv3+',
|
||||
|
|
|
@ -271,6 +271,9 @@ class TestConfig:
|
|||
def books_loader(self):
|
||||
return self._books_loader
|
||||
|
||||
def books_repo(self):
|
||||
return None
|
||||
|
||||
def config_file_path(self):
|
||||
return test_path('userconfig/conservancy_beancount/config.ini')
|
||||
|
||||
|
|
Loading…
Reference in a new issue