Commit graph

556 commits

Author SHA1 Message Date
Brett Smith
c88c5ef3b0 accruals: AccrualPostings only reports inconsistent cost per currency.
Of course if an accrual has multiple currencies, it'll probably have
different costs, and that's fine.
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
069939b2d3 reports: Balance classes support addition. 2020-06-03 18:53:17 -04:00
Brett Smith
cc0656dde9 reports: Add Balance.__abs__() method. 2020-06-03 18:52:44 -04:00
Brett Smith
58b02b6f33 accrual: Move more functionality into AccrualPostings. 2020-06-03 18:51:48 -04:00
Brett Smith
677c99b565 accrual: Filter opening balance txn before main reporting.
So far we've been implicitly relying on this by the user passing search
terms that filter out the opening balance transaction. That will stop
happening with the aging report, so we need to do it ourselves.
2020-06-03 18:51:48 -04:00
Brett Smith
39c9c0d83a reports: Add RelatedPostings.__repr__() method. 2020-06-03 18:51:44 -04:00
Brett Smith
7301bfc099 accrual: Add AccrualPostings.make_consistent() method.
This will help the aging report better render dirty data.
2020-06-03 18:51:44 -04:00
Brett Smith
b37d7a3024 reports: Make RelatedPostings an immutable data structure.
This was an early mistake, it makes data consistency mistakes too
easy, and I only used it once so far in actual code. Going to fix
this now so I can more safely build on top of this data structure.
2020-06-03 18:51:38 -04:00
Brett Smith
dd949a4866 reports: Define RelatedPostings.__slots__. 2020-05-30 10:40:24 -04:00
Brett Smith
aef00ce83f accrual: Check the consistency of accruals' cost. 2020-05-30 10:35:29 -04:00
Brett Smith
a008a09477 filters: Add remove_opening_balance_txn. 2020-05-30 08:30:07 -04:00
Brett Smith
32b62df540 cliutil: Better implementation of is_main_script.
The old one could return True if you called accrual.main()
directly from one-off test scripts.
2020-05-29 23:39:27 -04:00
Brett Smith
e07a47ec8f accrual: Use cliutil for better logging and error reporting. 2020-05-29 22:05:26 -04:00
Brett Smith
3fbd05d553 cliutil: Add is_main_script function. 2020-05-29 22:05:26 -04:00
Brett Smith
2b550a2037 cliutil: Start module.
We're probably going to have a small handful of reporting tools.
This module has all the stuff I end up putting in all of them.
2020-05-29 22:05:26 -04:00
Brett Smith
3a0b85c8f0 tests: Add test for trying to make outgoing report without rt-id.
Changes to other test cases are to make them *not* trip up this
error after adding it to the books.
2020-05-28 17:03:52 -04:00
Brett Smith
d3e0a38073 accrual: Introduce logging infrastructure. 2020-05-28 16:42:36 -04:00
Brett Smith
8b2683d962 accrual: Refactor reports into classes.
Preparation for introducing the aging report. This helps us
distinguish each report's setup requirements (different __init__ arguments).
2020-05-28 15:52:10 -04:00
Brett Smith
9223940213 tests: Refactor accrual tests.
Preparation for adding the aging report.
2020-05-28 15:52:09 -04:00
Brett Smith
eaae2b4a44 tests: Set locale environment variables.
To help tests get consistent formatting of currency.
2020-05-28 15:52:09 -04:00
Brett Smith
f66460f343 accrual: Outgoing report includes total at cost. 2020-05-28 09:05:18 -04:00
Brett Smith
d8df34ebaf reports: Balance.format() accepts None as a format. 2020-05-28 09:03:23 -04:00
Brett Smith
2c44cc8f50 reports: Add Balance.format() method. 2020-05-28 09:03:19 -04:00
Brett Smith
3780c31c59 reports: Add Balance.__eq__() method.
It turns out the provided implementation gets us most of the way there,
we just needed to add handling for the special case of zero balances.
Now it's confirmed with tests.
2020-05-28 09:01:00 -04:00
Brett Smith
81d216f282 reports: Add RelatedPostings.balance_at_cost() method.
This makes it easy to get results similar to `ledger -V`.
2020-05-28 09:01:00 -04:00
Brett Smith
52fa66bba1 data: Specify the type of Posting.cost.
The rationale is the same as it was for Posting.amount.
2020-05-28 09:01:00 -04:00
Brett Smith
8f014df515 setup: Document Debian packages for dependencies when available. 2020-05-25 11:16:57 -04:00
Brett Smith
fea306b278 books.Loader: Ensure load_all properly sorts in chronological order.
The test changes make them order-sensitive, which they should be.
It's important that our loader methods return date-sorted entries
just like Beancount itself would.
2020-05-25 11:16:17 -04:00
Brett Smith
9595d3334d books: Add Loader.load_all method. 2020-05-25 10:38:02 -04:00
Brett Smith
6801d12359 tests: Remove unused import. 2020-05-25 10:38:02 -04:00
Brett Smith
b7aae7b3c0 reports.accrual: Exclude payments from default output. RT#11294.
This makes the output more useful for broad searches like on an
entity. Invoices that cross FY boundaries will appear to be paid
without being accrued, and so would appear when we were just
filtering zeroed-out invoices.

If we integrate the aging report into this module in the future,
that'll need to follow different logic, and just filter out
zeroed-out invoices. But the basic balance report and outgoing
report are more workaday tools, where more filtering makes them
more useful.
2020-05-23 10:13:17 -04:00
Brett Smith
68c2c1e6f8 reports.accrual: Sort imports. 2020-05-23 10:13:02 -04:00
Brett Smith
13df0390a1 tests: Generate configuration in accrual-report tests.
Usually reduces the amount of testing boilerplate.
2020-05-23 08:49:20 -04:00
Brett Smith
396173b55d reports.Balance: Add eq_zero, ge_zero, and le_zero methods.
Support for RT#11294.
2020-05-21 23:10:03 -04:00
Brett Smith
1286cc2200 setup: Version bump for validation changes. 2020-05-21 23:00:06 -04:00
Brett Smith
552ef45f47 plugin: Be more selective about when ! skips validation.
It makes sense to let the bookkeeper skip validations in situations
where the metadata requires information that might not be available
when entered. It does not make sense to skip validations that *must*
be available and affect the structure of the books, like project and
entity.

This commit ensures every plugin hook has a test for flagged
transactions, even for hooks that currently have the desired
behavior where no code changes were required for the test to
pass.
2020-05-21 21:58:48 -04:00
Brett Smith
e3e782c028 tests: Style cleanup. 2020-05-21 21:57:29 -04:00
Brett Smith
b296fb0207 accrual: Add docstring with program overview. 2020-05-20 10:52:08 -04:00
Brett Smith
b8d76ec5a0 meta_entity: Don't validate entries out of date range. 2020-05-19 10:30:50 -04:00
Brett Smith
47235f694c accrual: Outgoing report doesn't put RT web links in < >.
The RT web interface doesn't handle angle brackets well, making the
`>` part of the link.
2020-05-18 17:05:01 -04:00
Brett Smith
b142e8fc31 accrual: Bugfix last commit. 2020-05-18 15:31:00 -04:00
Brett Smith
f64143db44 accrual: Outgoing report handles requestors without RealName. 2020-05-18 14:44:34 -04:00
Brett Smith
a8a1a53c7c accrual: Nicer whitespace in outgoing report. 2020-05-18 09:25:04 -04:00
Brett Smith
dcbac5db98 setup: Install subpackages. 2020-05-18 09:21:08 -04:00
Brett Smith
912c6f3de1 setup: 1.0 release. 2020-05-18 08:39:11 -04:00
Brett Smith
def05b8007 accrual: More robust payment-to fallback in outgoing report. 2020-05-17 16:39:22 -04:00
Brett Smith
18800b249d config: Let user specify books dir with ~. 2020-05-17 14:52:23 -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
3c77f8b3c7 plugin: Revert default validation start date to FY2020.
While we ultimately want this change, it reveals a lot of errors
in the FY2019 books that we don't want to gum up the transition.
2020-05-16 10:32:39 -04:00