Commit graph

264 commits

Author SHA1 Message Date
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
Brett Smith
adf402442b books: Introduce Year type alias.
This is going to be repeated a lot as we write book-loading methods.
2020-04-21 09:51:27 -04:00
Brett Smith
51137815d3 config: fiscal_year_begin returns a FiscalYear. 2020-04-21 09:07:14 -04:00
Brett Smith
5c60666619 books: Start FiscalYear class. 2020-04-20 17:20:26 -04:00
Brett Smith
894f044093 config: Add Config.fiscal_year_begin() method. 2020-04-20 14:31:22 -04:00
Brett Smith
7f45788235 config: Start configuration file with books path.
Ultimately I would like to make it possible to configure the software
entirely through this file, rather than the hodgepodge system we have
now. But that can come later.
2020-04-12 22:27:52 -04:00
Brett Smith
8fa9a0ffe6 tests: Set XDG_CONFIG_HOME for safety. 2020-04-12 22:24:34 -04:00
Brett Smith
b28646aa12 core.RelatedPostings: Add iter_with_balance method.
payment-report and accrual-report query to find the last date a
series of postings had a non/zero balance. This method is a good
building block for that.
2020-04-12 15:18:19 -04:00
Brett Smith
5aa30e5456 reports.core: Start Balance class. 2020-04-12 14:56:00 -04:00
Brett Smith
219cd4bc37 reports.core: Start RelatedPostings class. 2020-04-12 09:47:41 -04:00
Brett Smith
171aed16f9 data: Bugfix super() arguments in Amount.__new__.
Apparently I was more tired than I realized last night.
2020-04-12 08:58:27 -04:00
Brett Smith
01c3b975d8 data: Fix Amount.__new__.
See the comments for background and rationale.
2020-04-11 22:26:01 -04:00
Brett Smith
14a87e792b data: Move iter_posting into Posting class methods.
As I move into reporting code, having Posting.from_beancount() is
handy, and then from_txn() might as well come along for the ride.
2020-04-11 16:16:35 -04:00
Brett Smith
eb7f73e644 data.PostingMeta: Add date property.
This is something reporting tools will want a lot. This will make it
easier for them to look at just postings without worrying about the
parent transaction.
2020-04-11 09:20:35 -04:00
Brett Smith
a156617b4d config: Add Config.config_file_path() method. 2020-04-10 10:53:39 -04:00
Brett Smith
24813a9b81 config: Ignore non-absolute XDG_CACHE_HOME.
Per the spec.
2020-04-10 08:34:55 -04:00
Brett Smith
c7fbf5b5d5 config: s/XDG_CACHE_DIR/XDG_CACHE_HOME/g
Per the spec.
2020-04-10 08:24:34 -04:00
Brett Smith
9f0c30738d plugin: Most validations skip opening balance transactions. RT#10642. 2020-04-09 15:12:04 -04:00
Brett Smith
4eaba1ebf6 data: Add is_opening_balance_txn function. 2020-04-09 15:11:16 -04:00
Brett Smith
d66ba8773f data: Make balance_of currency-aware. 2020-04-09 14:13:07 -04:00
Brett Smith
c6dc2d83ac data.Amount: Introduce class and simplify code to use it.
See docstring for full rationale. This greatly reduces the need for other
plugin code to handle the case of `post.units.number is None`, eliminating
the need for entire methods and letting it do plain numeric comparisons.
2020-04-09 12:00:38 -04:00
Brett Smith
e00ec95d93 Account: Add is_opening_balance method. 2020-04-08 15:04:25 -04:00
Brett Smith
8f81530f6d meta_approval: Use data.balance_of. 2020-04-08 14:20:00 -04:00
Brett Smith
bb84cb5741 data.balance_of: Take account predicates, not just names.
For increased flexibility.
In particular, now you can pass in Account boolean methods to
call those directly.
2020-04-08 14:16:57 -04:00
Brett Smith
28e59e7a3b data: Add balance_of() function. 2020-04-08 11:55:00 -04:00
Brett Smith
212036b25e meta_approval: Stop checking payables.
That's handled by meta_payable_documentation now.
2020-04-07 15:45:29 -04:00
Brett Smith
ce34554bd4 meta_payable_documentation: Don't check Liabilites:Payable:Vacation. 2020-04-07 15:44:40 -04:00
Brett Smith
3dfe266945 meta_payable_documentation: Bugfix which metadata we're checking.
Checking approval/contract was in the original specification,
looking at invoice instead of approval was a pure brain fart.
2020-04-07 15:31:58 -04:00
Brett Smith
dd19e2a7a6 meta_payable_documentation: Start validation. RT#10643. 2020-04-07 15:29:15 -04:00
Brett Smith
f7bb036366 meta_receipt: Stop checking Assets:PayPal. RT#10637.
We only want to enforce paypal-id on these postings, and that's done with
the introduction of MetaPayPalID.
2020-04-07 14:47:02 -04:00
Brett Smith
21bea11beb meta_paypal_id: Start validator. RT#10260. 2020-04-07 14:41:06 -04:00
Brett Smith
0bf44ade7a plugin: Add HookRegistry.load_included_hooks() method.
This lets us import the plugin module without importing all of the included
hooks. This provides better isolation and error reporting in case there's
something like a syntax problem in one of the hooks: it doesn't cause
importing any plugin module to fail.
2020-04-07 13:31:09 -04:00
Brett Smith
fdb62dd1c6 plugin.core: _RequireLinksPostingMetadataHook can check several metadata.
Extend the base class from checking 1 metadata value to checking N.

This is preparation for RT#10643, letting payables be documented with
invoice or contract.

This does unify error reporting, because now we always report all
type/invalid value errors *plus* a missing error if appropriate.
I think this consistency and thoroughness is appropriate, although
it did require some adjustments to the tests.
2020-04-06 22:02:14 -04:00
Brett Smith
0413fed8b9 meta_entity: Use payee as entity when metadata not available. RT#10529. 2020-04-06 16:03:56 -04:00
Brett Smith
bff3eec952 tox: Start configuration to test on Py3.6 and Py3.7.
This caught several of the recent issues.
2020-04-06 15:25:14 -04:00
Brett Smith
cbd50af302 rtutil: Explicit fspath cast to avoid a Py3.6 typecheck issue.
On Py3.6, either sqlite3.connect() doesn't take a path-like object,
or the type stubs don't know that.
2020-04-06 15:21:56 -04:00
Brett Smith
e1c507c025 plugin.core: Less introspective DIRECTIVE setting.
Python 3.6 does not implement __class_getitem__, and because of that
it's not possible to introspect when things like Hook[Transaction]
are called. Sidestep the issue with a more explicit assignment.
2020-04-06 15:18:54 -04:00
Brett Smith
6f3e5eb905 plugin.core: Clean goofy indirect import. 2020-04-06 14:58:21 -04:00
Brett Smith
18a513a694 setup: Add overlooked PyYAML dependency.
Needed by meta_repo_links.
2020-04-06 14:32:41 -04:00
Brett Smith
0d80c2282c test_meta_invoice: Add explicit "missing invoice" tests.
I wrote this while debugging something else, and I don't want to let
a good test go to waste.
2020-04-06 10:15:17 -04:00
Brett Smith
600c9d9d6f meta_receipt: Correctly fall back to other metadata on zero-value postings.
RT#10633.
2020-04-05 15:29:04 -04:00
Brett Smith
4437a130d6 meta_receivable_docs: Not required for paid receivables. RT#10634. 2020-04-05 15:06:10 -04:00
Brett Smith
f24f941cfb meta_approval: Not required for bank transfers. RT#10635. 2020-04-05 14:49:39 -04:00