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:
|
if rt_wrapper is None:
|
||||||
logger.error("unable to generate aging report: RT client is required")
|
logger.error("unable to generate aging report: RT client is required")
|
||||||
else:
|
else:
|
||||||
now = datetime.datetime.now()
|
|
||||||
if args.output_file is None:
|
if args.output_file is None:
|
||||||
|
now = datetime.datetime.now()
|
||||||
out_dir_path = config.repository_path() or Path()
|
out_dir_path = config.repository_path() or Path()
|
||||||
args.output_file = out_dir_path / now.strftime('AgingReport_%Y-%m-%d_%H:%M.ods')
|
args.output_file = out_dir_path / now.strftime('AgingReport_%Y-%m-%d_%H:%M.ods')
|
||||||
logger.info("Writing report to %s", args.output_file)
|
logger.info("Writing report to %s", args.output_file)
|
||||||
out_bin = cliutil.bytes_output(args.output_file, stdout)
|
out_bin = cliutil.bytes_output(args.output_file, stdout)
|
||||||
report = AgingReport(rt_wrapper, out_bin)
|
report = AgingReport(rt_wrapper, out_bin)
|
||||||
|
report.ods.set_common_properties(config.books_repo())
|
||||||
elif args.report_type is ReportType.OUTGOING:
|
elif args.report_type is ReportType.OUTGOING:
|
||||||
rt_wrapper = config.rt_wrapper()
|
rt_wrapper = config.rt_wrapper()
|
||||||
if rt_wrapper is None:
|
if rt_wrapper is None:
|
||||||
|
|
|
@ -394,6 +394,7 @@ def main(arglist: Optional[Sequence[str]]=None,
|
||||||
report.write(fund_map.items())
|
report.write(fund_map.items())
|
||||||
else:
|
else:
|
||||||
ods_report = ODSReport(args.start_date, args.stop_date)
|
ods_report = ODSReport(args.start_date, args.stop_date)
|
||||||
|
ods_report.set_common_properties(config.books_repo())
|
||||||
ods_report.write(fund_map.items())
|
ods_report.write(fund_map.items())
|
||||||
if args.output_file is None:
|
if args.output_file is None:
|
||||||
out_dir_path = config.repository_path() or Path()
|
out_dir_path = config.repository_path() or Path()
|
||||||
|
|
|
@ -809,6 +809,7 @@ def main(arglist: Optional[Sequence[str]]=None,
|
||||||
except ValueError as error:
|
except ValueError as error:
|
||||||
logger.error("%s: %r", *error.args)
|
logger.error("%s: %r", *error.args)
|
||||||
return 2
|
return 2
|
||||||
|
report.set_common_properties(config.books_repo())
|
||||||
report.write(postings)
|
report.write(postings)
|
||||||
if not any(report.account_groups.values()):
|
if not any(report.account_groups.values()):
|
||||||
logger.warning("no matching postings found to report")
|
logger.warning("no matching postings found to report")
|
||||||
|
|
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.6.2',
|
version='1.6.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+',
|
||||||
|
|
|
@ -271,6 +271,9 @@ class TestConfig:
|
||||||
def books_loader(self):
|
def books_loader(self):
|
||||||
return self._books_loader
|
return self._books_loader
|
||||||
|
|
||||||
|
def books_repo(self):
|
||||||
|
return None
|
||||||
|
|
||||||
def config_file_path(self):
|
def config_file_path(self):
|
||||||
return test_path('userconfig/conservancy_beancount/config.ini')
|
return test_path('userconfig/conservancy_beancount/config.ini')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue