Commit graph

356 commits

Author SHA1 Message Date
Brett Smith
aa488effb0 books.Loader: New loading strategy based on load_file. RT#11034.
Building a string and loading it means Beancount can never cache any
load. It only caches top-level file loads because options in the
top-level file can change the semantics of included entries.

Instead use load_file as much as possible, and filter entries as
needed.
2020-05-16 10:29:06 -04:00
Brett Smith
1e09339b32 config: Make payment threshold configurable. 2020-05-16 09:51:02 -04:00
Brett Smith
2b7c1acff4 meta_receipt: Allow invoice as fallback documentation for checking credits.
We need this for incoming ACH where there is neither a receipt nor check.
2020-05-15 16:48:45 -04:00
Brett Smith
51db04dc20 test_meta_receipt: Prepare for multiple fallback meta keys. 2020-05-15 16:46:20 -04:00
Brett Smith
c1ecc48297 rtutil: Avoid loading from a URI in RTLinkCache.setup.
See comments for rationale. RT#10543.
2020-05-13 10:48:09 -04:00
Brett Smith
66cd27e7f0 test_rtutil: Capture debug logs for test_read_only_cache.
To help with SUSE installation, RT#10543.
2020-05-13 10:25:24 -04:00
Brett Smith
079d8ec9a3 rtutil: Add debug logging to RTLinkCache.setup.
To help with RT#10543.
2020-05-13 10:25:21 -04:00
Brett Smith
30e386f645 test_rtutil: Implement our own nullcontext.
contextlib.nullcontext does not exist in Python 3.6.
2020-05-13 10:12:08 -04:00
Brett Smith
031b660cc6 plugin: Move up default start validation date. 2020-05-11 09:53:14 -04:00
Brett Smith
536b50b478 plugin: Don't validate transactions flagged with !. RT#10591. 2020-05-11 09:52:05 -04:00
Brett Smith
56b644f1db meta_entity: More battle testing.
See the test cases for examples of real entities in the books
that we should accept for now.
2020-05-06 10:26:25 -04:00
Brett Smith
072937eff5 books.Loader: New loading strategy.
The old loading strategy didn't load options, which yielded some
spurious errors. It also created awkward duplication of plugin
information in the code as well as the books.

Implement a new loading strategy that works by reading one of the
"main files" under the books/ subdirectory and includes entries
for additional FYs beyond that.

This is still not ideal in a lot of ways. In particular, Beancount can't
cache any results, causing any load to be slower than it theoretically could
be. I expect more commits to follow. But some of them might require
restructuring the books, and that should happen separately.
2020-05-05 14:31:08 -04:00
Brett Smith
ca1f6d0059 tests: Add accruals.beancount required for tests in last commit. 2020-05-05 14:30:39 -04:00
Brett Smith
ad81c45f2a reports.accrual: Begin reporting.
This module basically reimplements the old payment-report+income-report,
in a single tool (after setting aside some of the checks that have moved
to the plugin). The aging report can be implemented here too when we need
that.
2020-05-04 16:36:59 -04:00
Brett Smith
5608893816 beancount_types: Error.source is not Optional. 2020-05-04 14:25:52 -04:00
Brett Smith
e429a6c6fd meta_approval: Not required for chargebacks. RT#10978. 2020-05-01 16:24:24 -04:00
Brett Smith
23e1ed7cee Revert "meta_receipt: Don't check chargebacks. RT#10978."
This reverts commit 6aadb740e6.
This is supposed to be done in meta_approval, not meta_receipt.
2020-05-01 16:20:22 -04:00
Brett Smith
6aadb740e6 meta_receipt: Don't check chargebacks. RT#10978. 2020-05-01 16:18:46 -04:00
Brett Smith
be35f36d26 meta_tax_implication: Add Chargeback value. 2020-05-01 15:54:40 -04:00
Brett Smith
08a3151bfa meta_tax_implication: Remove unused values. 2020-05-01 15:52:27 -04:00
Brett Smith
bbd99e96c0 plugin: Don't check payable documentation for now.
I believe we still want this in principle, but we're not currently enforcing
it the way I thought we were, and we very regularly write Payables without
this supporting documentation (for trip reimbursement, regular service fees,
etc.). Enforcing this now would be way too noisy in the books, we need to
devise a separate plan to enforce this if we want it.
2020-05-01 12:02:07 -04:00
Brett Smith
1b81375294 reports: Add Balance.__neg__() method. 2020-04-29 14:35:20 -04:00
Brett Smith
68acb86e7e reports: Add Balance.__str__() method. 2020-04-29 11:37:38 -04:00
Brett Smith
5a1f7122bd rtutil: Add RT.iter_urls() method. 2020-04-29 11:23:48 -04:00
Brett Smith
9fef177d2d reports: Add RelatedPostings.all_meta_links() method. 2020-04-29 10:12:08 -04:00
Brett Smith
46ac91e86e test_rtutil: Simplify setup. 2020-04-28 17:20:59 -04:00
Brett Smith
bd0d607032 typing: Annotate Iterators more specifically. 2020-04-28 16:35:15 -04:00
Brett Smith
999ca2c5e1 rtutil: Add RT.txn_with_urls() method. 2020-04-28 16:20:25 -04:00
Brett Smith
701ccdc192 tests: Test where Transactions are real NamedTuples.
This makes methods like _replace available in real code, and caught the
bug where we can't use @functools.lru_cache with Transaction arguments,
because they're unhashable due to their mutable members.
2020-04-28 15:33:30 -04:00
Brett Smith
e79877ee6a data: Add rt-id to LINK_METADATA.
This gets closer to our real intentions: anything that checks link
metadata should check rt-id. MetaRepoLinks is the exception, not
the rule, in ignoring rt-id.
2020-04-28 10:48:10 -04:00
Brett Smith
694630ca02 setup: Don't disallow untyped calls.
Unfortunately this is becoming more trouble than it's worth as we
call more and more untyped Beancount functions.
disallow_untyped_defs provides most of the value of what we really
want here, so go ahead and turn this off.
2020-04-27 16:53:22 -04:00
Brett Smith
1383dabf3b beancount_types: Make Error.source a Mapping rather than a Dict.
The Beancount code just needs a mapping, and this lets us use
Metadata or PostingMeta objects for Error sources.
2020-04-27 16:44:39 -04:00
Brett Smith
d3415a8721 data: Type declare that Posting.meta is a PostingMeta.
This is necessary for users to call PostingMeta properties like date
as intended.
2020-04-27 16:44:06 -04:00
Brett Smith
d01df054ab reports: Let RelatedPostings be initialized with an Iterable[Posting]. 2020-04-27 15:51:30 -04:00
Brett Smith
5e061da940 reports: Fix return type of RelatedPostings.group_by_meta. 2020-04-24 15:36:02 -04:00
Brett Smith
bd00822b8f reports: Add RelatedPostings.group_by_meta() classmethod. 2020-04-24 13:37:35 -04:00
Brett Smith
fdd067b10e tests: Add sample configuration file.
This should've been included in 7f45788.
2020-04-23 11:41:07 -04:00
Brett Smith
d8507a1a35 rtutil: Add RTUtil.metadata_regexp() classmethod.
The accruals check script wants to be able to search RT links in
all kinds of metadata, not just rt-id as the filter currently
handles.
2020-04-23 10:27:47 -04:00
Brett Smith
d41bc5e9b6 reports: Add RelatedPostings.clear() method. 2020-04-22 12:02:06 -04:00
Brett Smith
ed4258daf7 reports: Add RelatedPostings.meta_values() method.
This corresponds to the ledtag_onevalue check in the
payment-report and income-report scripts.
2020-04-22 11:59:12 -04:00
Brett Smith
54a1bc4600 filters: Add filter_for_rt_id function. 2020-04-22 10:59:12 -04:00
Brett Smith
4420873c96 filters: Add filter_meta_match function. 2020-04-22 10:34:55 -04:00
Brett Smith
26762e11ef test_filters: Test non-string metadata values. 2020-04-22 10:31:52 -04:00
Brett Smith
cc03c4beb6 filters: Add filter_meta_equal function. 2020-04-22 10:04:24 -04:00
Brett Smith
99dbd1ac95 tests: Promote date_seq to testutil. 2020-04-22 09:17:58 -04:00
Brett Smith
8d584734ec data: Add Posting.from_entries() method. 2020-04-21 15:24:04 -04:00
Brett Smith
3000aeee09 config: Add Config.books_loader() method. 2020-04-21 13:35:56 -04:00
Brett Smith
96a363633f books: Add Loader.load_fy_range() method. 2020-04-21 11:58:28 -04:00
Brett Smith
43a2e1bec8 beancount_types: Add types related to loading the books.
These will help support loading methods in the books module.
2020-04-21 11:57:54 -04:00
Brett Smith
855c1c2bf0 books: Start Loader class. 2020-04-21 10:47:13 -04:00