accrual: Change args.since default.

This default makes more since with the way we're going to stop having
opening balances in open books.
This commit is contained in:
Brett Smith 2020-06-17 15:22:42 -04:00
parent 0caf78436f
commit 5e295f1024

View file

@ -19,10 +19,10 @@ criteria::
# Report all accruals with the invoice link Invoice980.pdf. # Report all accruals with the invoice link Invoice980.pdf.
accrual-report Invoice980.pdf accrual-report Invoice980.pdf
By default, to stay fast, accrual-report only looks for postings from the By default, to stay fast, accrual-report only looks at unaudited books. You
beginning of the last fiscal year. You can search further back in history can search further back in history by passing the ``--since`` argument. The
by passing the ``--since`` argument. The argument can be a fiscal year, or argument can be a fiscal year, or a negative number of how many years back
a negative number of how many years back to search:: to search::
# Search for accruals since 2016 # Search for accruals since 2016
accrual-report --since 2016 [search terms ] accrual-report --since 2016 [search terms ]
@ -601,11 +601,11 @@ and `balance` any other time.
'--since', '--since',
metavar='YEAR', metavar='YEAR',
type=int, type=int,
default=-1, default=0,
help="""How far back to search the books for related transactions. help="""How far back to search the books for related transactions.
You can either specify a fiscal year, or a negative offset from the current You can either specify a fiscal year, or a negative offset from the current
fiscal year, to start loading entries from. The default is -1 (start from the fiscal year, to start loading entries from. The default is to load the current,
previous fiscal year). unaudited books.
""") """)
parser.add_argument( parser.add_argument(
'--output-file', '-O', '--output-file', '-O',
@ -650,10 +650,9 @@ def main(arglist: Optional[Sequence[str]]=None,
books_loader = config.books_loader() books_loader = config.books_loader()
if books_loader is None: if books_loader is None:
entries, load_errors, _ = books.Loader.load_none(config.config_file_path()) entries, load_errors, _ = books.Loader.load_none(config.config_file_path())
elif args.report_type is ReportType.AGING:
entries, load_errors, _ = books_loader.load_all()
else: else:
entries, load_errors, _ = books_loader.load_all(args.since) load_since = None if args.report_type == ReportType.AGING else args.since
entries, load_errors, _ = books_loader.load_all(load_since)
filters.remove_opening_balance_txn(entries) filters.remove_opening_balance_txn(entries)
for error in load_errors: for error in load_errors:
bc_printer.print_error(error, file=stderr) bc_printer.print_error(error, file=stderr)