statement: Accept search terms.
This is the most consistent way to be able to reconcile specific kinds of payroll taxes.
This commit is contained in:
parent
32eaf08552
commit
b5a22a963f
2 changed files with 19 additions and 4 deletions
|
@ -341,7 +341,7 @@ The default is one month after the start date.
|
||||||
action='append',
|
action='append',
|
||||||
help="""Reconcile this account. You can specify this option
|
help="""Reconcile this account. You can specify this option
|
||||||
multiple times. You can specify a part of the account hierarchy, or an account
|
multiple times. You can specify a part of the account hierarchy, or an account
|
||||||
classification from metadata. Default 'Cash'.
|
classification from metadata. Default adapts to your search criteria.
|
||||||
""")
|
""")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--id-metadata-key', '-i',
|
'--id-metadata-key', '-i',
|
||||||
|
@ -361,10 +361,22 @@ been reconciled. Default varies by account.
|
||||||
type=Path,
|
type=Path,
|
||||||
help="""Write the report to this file, or stdout when PATH is `-`.
|
help="""Write the report to this file, or stdout when PATH is `-`.
|
||||||
The default is `ReconciliationReport_<StartDate>_<StopDate>.ods`.
|
The default is `ReconciliationReport_<StartDate>_<StopDate>.ods`.
|
||||||
|
""")
|
||||||
|
parser.add_argument(
|
||||||
|
'search_terms',
|
||||||
|
metavar='FILTER',
|
||||||
|
type=cliutil.SearchTerm.arg_parser(),
|
||||||
|
nargs=argparse.ZERO_OR_MORE,
|
||||||
|
help="""Report on postings that match this criteria. The format is
|
||||||
|
NAME=TERM. TERM is a link or word that must exist in a posting's NAME
|
||||||
|
metadata to match.
|
||||||
""")
|
""")
|
||||||
args = parser.parse_args(arglist)
|
args = parser.parse_args(arglist)
|
||||||
if not args.accounts:
|
if not args.accounts:
|
||||||
args.accounts = ['Cash']
|
if any(term.meta_key == 'payroll-type' for term in args.search_terms):
|
||||||
|
args.accounts = ['Expenses:Payroll']
|
||||||
|
else:
|
||||||
|
args.accounts = ['Cash']
|
||||||
return args
|
return args
|
||||||
|
|
||||||
def main(arglist: Optional[Sequence[str]]=None,
|
def main(arglist: Optional[Sequence[str]]=None,
|
||||||
|
@ -425,6 +437,9 @@ def main(arglist: Optional[Sequence[str]]=None,
|
||||||
rt_wrapper = config.rt_wrapper()
|
rt_wrapper = config.rt_wrapper()
|
||||||
if rt_wrapper is None:
|
if rt_wrapper is None:
|
||||||
logger.warning("could not initialize RT client; spreadsheet links will be broken")
|
logger.warning("could not initialize RT client; spreadsheet links will be broken")
|
||||||
|
postings = data.Posting.from_entries(entries)
|
||||||
|
for search_term in args.search_terms:
|
||||||
|
postings = search_term.filter_postings(postings)
|
||||||
|
|
||||||
report = StatementReconciliation(
|
report = StatementReconciliation(
|
||||||
rt_wrapper,
|
rt_wrapper,
|
||||||
|
@ -435,7 +450,7 @@ def main(arglist: Optional[Sequence[str]]=None,
|
||||||
args.statement_metadata_key,
|
args.statement_metadata_key,
|
||||||
args.id_metadata_key,
|
args.id_metadata_key,
|
||||||
)
|
)
|
||||||
report.write(data.Posting.from_entries(entries))
|
report.write(postings)
|
||||||
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()
|
||||||
args.output_file = out_dir_path / 'ReconciliationReport_{}_{}.ods'.format(
|
args.output_file = out_dir_path / 'ReconciliationReport_{}_{}.ods'.format(
|
||||||
|
|
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.17.0',
|
version='1.17.1',
|
||||||
author='Software Freedom Conservancy',
|
author='Software Freedom Conservancy',
|
||||||
author_email='info@sfconservancy.org',
|
author_email='info@sfconservancy.org',
|
||||||
license='GNU AGPLv3+',
|
license='GNU AGPLv3+',
|
||||||
|
|
Loading…
Reference in a new issue