From f56d89462a86a65f759c502a513b6f213ac92341 2020-07-29 21:30:07 From: Brett Smith Date: 2020-07-29 21:30:07 Subject: [PATCH] reports: Add common properties to all ODS reports. --- diff --git a/conservancy_beancount/reports/accrual.py b/conservancy_beancount/reports/accrual.py index eb3b137f08a97e7af00ed18c069dc83ef5a80efe..074b83158841c8f5c39d850bda976e0d3306df3a 100644 --- a/conservancy_beancount/reports/accrual.py +++ b/conservancy_beancount/reports/accrual.py @@ -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: diff --git a/conservancy_beancount/reports/fund.py b/conservancy_beancount/reports/fund.py index 90df1ffe74130047712a00e69803a17f245f897c..4affa819f602103803a47b9f9a7f64ae6abba9e1 100644 --- a/conservancy_beancount/reports/fund.py +++ b/conservancy_beancount/reports/fund.py @@ -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() diff --git a/conservancy_beancount/reports/ledger.py b/conservancy_beancount/reports/ledger.py index e180910222e05b34eac9afe3ff7486727b259642..9929eaf23cf2b76e34efdea8f801d34d13cfff16 100644 --- a/conservancy_beancount/reports/ledger.py +++ b/conservancy_beancount/reports/ledger.py @@ -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") diff --git a/setup.py b/setup.py index beb8920e9e4c93bd957c459e09222094e4dfd032..f09adeb96359581fa96e87b47ab0c7a7dbc44c2e 100755 --- a/setup.py +++ b/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+', diff --git a/tests/testutil.py b/tests/testutil.py index 74ae8f24cfae926af23fe02f6de24dfdd83ffc89..def907546f82095bf0f4d7bedc94392732cbde31 100644 --- a/tests/testutil.py +++ b/tests/testutil.py @@ -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')