Commit graph

48 commits

Author SHA1 Message Date
Brett Smith
ee2bd6c096 books: All tools use books.Loader.dispatch() and LoadResult.
This is significant code deduplication, as seen in the diffstat.
2021-02-24 13:15:33 -05:00
Brett Smith
fdd9f2847b plugin: Skip enum value checks with a flag+FIXME.
We've long supported skipping documentation checks by flagging the
transaction. We haven't done the same for enumerated metadata because we
need it less often, and bad values tend to do more damage to reports.

However, occasionally when something very off-process happens, we do need it
as a matter of expediency. So support it.

In order to skip validation of these fields, the plugin requires that the
value start with the string "FIXME". This helps ensure that reports have a
consistent way to detect and warn about unfilled values in flagged
transactions.
2021-01-29 09:38:37 -05:00
Brett Smith
1b7fdf4f3b Clarify and organize license info including additional permission. 2021-01-08 16:58:04 -05:00
Brett Smith
f55fccd48d plugin: Add TransactionDate hook. RT#10566
This prevents mistakes where a transaction is entered in the wrong file for
its date (which in turns causes errors in reports).
2020-09-10 16:59:29 -04:00
Brett Smith
f56d89462a reports: Add common properties to all ODS reports. 2020-07-29 17:30:07 -04:00
Brett Smith
837fcec8f0 reports: Add BaseODS.set_common_properties() method. 2020-07-29 17:22:09 -04:00
Brett Smith
3f0b201d16 ledger: --account accepts a classification.
This makes it easier for users to specify a group of accounts.
2020-07-16 15:12:20 -04:00
Brett Smith
87e715df7c tests: Make clean_account_meta a teardown fixture. 2020-07-16 10:39:48 -04:00
Brett Smith
fff9e37bf8 data: Add Account.is_account and Account.load_options_map.
These work in concert to distinguish account names from other
colon-separated strings.
2020-07-16 10:11:39 -04:00
Brett Smith
6a7815090c data: Add AccountMeta class. 2020-07-15 10:27:05 -04:00
Brett Smith
5085d4d8ef accrual: Outgoing report sets RT CFs for outgoing payment. 2020-06-23 14:47:03 -04:00
Brett Smith
9782e7203a ledger: New reporting module. 2020-06-16 10:18:18 -04:00
Brett Smith
cd578289c4 cliutil: Add make_entry_point() function.
This provides better logging setup, reduces the amount of boilerplate in
main, and replaces is_main_script().
2020-06-12 15:08:08 -04:00
Brett Smith
1cbc9d3dc9 tests: Add _meta_type kwarg to testutil.Posting. 2020-06-11 13:07:14 -04:00
Brett Smith
2bd3e8b462 books: Loader.from_all() accepts a start FY argument. 2020-06-04 09:03:10 -04:00
Brett Smith
f8f57428aa accrual: Introduce aging report. RT#10694. 2020-06-03 22:20:37 -04:00
Brett Smith
70057fe383 reports: Start BaseODS class. 2020-06-03 21:24:47 -04:00
Brett Smith
3d704e2865 reports: Balance is initialized with just amounts.
This works fine with how we're currently using it, makes transformation
methods easier to implement, and avoids potential bugs where a balance is
initialized with a bad mapping.
2020-06-03 18:54:12 -04:00
Brett Smith
f64143db44 accrual: Outgoing report handles requestors without RealName. 2020-05-18 14:44:34 -04:00
Brett Smith
55de5627f2 reports.accrual: Outgoing report uses payment-to custom field. RT#10656. 2020-05-16 11:31:00 -04:00
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
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
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
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
99dbd1ac95 tests: Promote date_seq to testutil. 2020-04-22 09:17:58 -04:00
Brett Smith
5aa30e5456 reports.core: Start Balance class. 2020-04-12 14:56:00 -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
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
28e59e7a3b data: Add balance_of() function. 2020-04-08 11:55:00 -04:00
Brett Smith
a9eab2d4ea meta_receivable_documentation: Start hook. 2020-03-31 11:42:21 -04:00
Brett Smith
30d371278a plugin: Refactor hooks to use new payment-related methods. 2020-03-29 10:30:54 -04:00
Brett Smith
93feb2f4a3 data: Add Posting.is_payment() method. 2020-03-29 10:18:51 -04:00
Brett Smith
2909c405e6 meta_receipt: Start hook. 2020-03-28 22:19:49 -04:00
Brett Smith
d9420ac2b6 meta_invoice: Start hook. 2020-03-28 14:31:17 -04:00
Brett Smith
9b63d898af data: Add Metadata class.
As I start writing more link-checking hooks, I want a common place to
write link-parsing code.  This new class will be that place.
2020-03-28 13:35:38 -04:00
Brett Smith
91a436abd5 testutil: Fix missing return typo. 2020-03-25 10:50:50 -04:00
Brett Smith
4874a107e8 meta_rt_links: Start hook. 2020-03-25 00:12:20 -04:00
Brett Smith
d5a6141f6d rtutil: Start module.
For now, this is basically the Python version of
ledger-tag-convert.plx.  It knows how to create RT web links from
ticket and attachment IDs.  It confirms that those objects actually
exist too.  It may grow to encompass other functionality in the
future.
2020-03-24 17:23:54 -04:00
Brett Smith
f09f029fc4 config: Add Config.rt_client method. 2020-03-24 09:08:08 -04:00
Brett Smith
8d3816a8fd config: Add Config.rt_credentials method.
This loads settings from the same environment variables and ~/.rtrc
file as the rt CLI.

Note that it does *not* support RTCONFIG and the config file
searching, because right now that seems like more work for more
trouble to me.
2020-03-23 15:19:15 -04:00
Brett Smith
1500d2d9d8 meta_project: Start hook. 2020-03-20 12:08:10 -04:00
Brett Smith
0d370c445b plugin: User configuration is passed to hooks on initialization. 2020-03-19 17:23:27 -04:00
Brett Smith
f1c115de49 testutil: Improve check_post_meta error reporting.
This version makes it easier to get diffs between the expected
and actual metadata.
2020-03-19 09:32:06 -04:00
Brett Smith
e7720b8fb8 tests: Add check_post_meta.
This makes it simple to conveniently check all posting metadata in tests.
2020-03-16 10:15:31 -04:00
Brett Smith
547ae65780 plugin.core: _meta_set properly handles when post.meta is None.
post is a NamedTuple, so attribute assignment is not allowed.
Instead we have to construct a whole new Posting.
2020-03-08 11:32:03 -04:00
Brett Smith
16c47c64b2 expenseAllocation: Date-limit the transactions we work on.
This prevents the plugin from giving meaning to postings that
might not really be there.
2020-03-05 14:37:47 -05:00
Brett Smith
7862919022 expenseAllocation: Start checker.
This is the simplest version of a common validation we're going to do:
make sure that a particular piece of metadata has one of a set of
values.

This checker needs some bounds checking but I wanted to err on the
side of committing this early because it introduces so much base
infrastructure.
2020-03-05 12:05:13 -05:00