Commit graph

48 commits

Author SHA1 Message Date
Brett Smith
1b7fdf4f3b Clarify and organize license info including additional permission. 2021-01-08 16:58:04 -05:00
Brett Smith
ea69d58957 tests: Test updates for accrual report changes in the last commit.
Where assertions are removed from individual tests, I believe that
functionality is covered by other tests (although probably not to the extent
of checking multiple splits).
2020-10-24 11:31:39 -04:00
Brett Smith
db3ba4fd4d accrual: Add Prepaid Expenses to aging report. 2020-10-21 11:33:27 -04:00
Brett Smith
8597a526d7 cliutil: Use semi-standardized BSD exit codes. 2020-07-30 15:53:31 -04:00
Brett Smith
4615364538 cliutil: Add ReturnFlag.
Take this opportunity to re-standardize flag values now that it's clear
what's most common.
2020-07-27 10:54:04 -04:00
Brett Smith
708d48699a accrual: Restore "since last nonzero" behavior to outgoing report.
Basically this behavior is an extension of the fact that the outgoing report
is grouped by RT ticket rather than "accrual data." Ripping this
functionality out of other reports was correct, but it needed to stay for
the outgoing report.
2020-07-20 15:13:20 -04:00
Brett Smith
69d079190c tests: Test non-string values for payment-method metadata. 2020-07-02 13:08:21 -04:00
Brett Smith
a8a3f9d12b accrual: Better error handling and reporting around payment-method. 2020-07-02 10:56:51 -04:00
Brett Smith
7a0fa4fb57 accrual: Wire is a single payment method. 2020-07-01 13:43:58 -04:00
Brett Smith
42b3e6ca17 accruals: Aging report shows all unpaid accruals color coded by age.
Some readers care about recent accruals, some don't. This presentation
accommmodates both audiences, providing the data while making it easy to
ignore or filter out recent accruals.
2020-07-01 12:00:17 -04:00
Brett Smith
c0a2d1c070 accrual: Rip out unnecessary functionality.
Now that make_consistent is really robust, there's much less need to do all
the consistency checking that was done in AccrualPostings.__init__. I expect
this will provide a performance benefit for large reports, since we'll be
calculating data for many fewer accrual groups. The only performance penalty
I see is that the aging report has to calculate the balance three times for
each row it reports, twice in write() and once in write_row(), but that
seems okay and can be cached separately if needed.
2020-07-01 10:54:58 -04:00
Brett Smith
a5b3dc1463 accrual: AccrualPostings.make_consistent() groups accruals by date.
This accommodates cases of contracts without separate invoices,
where a series of payments are scheduled over time.

The dance we used to do of group-by-invoice, then make consistent was
already suspect. It was originally motivated by the consistency checks that
are now gone. Use this opportunity to clean up and just make make_consistent
a classmethod.
2020-07-01 09:50:20 -04:00
Brett Smith
5085d4d8ef accrual: Outgoing report sets RT CFs for outgoing payment. 2020-06-23 14:47:03 -04:00
Brett Smith
0caf78436f accrual: Generate an aging report in more cases.
Default to generating an aging report unless the user searched for a
specific RT ticket or invoice.
2020-06-17 15:32:08 -04:00
Brett Smith
9a7b9de08d test_reports_accrual: Clean imports. 2020-06-13 16:10:52 -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
3330c834b2 accrual: Only try to generate an outgoing report for accruals with rt-id. 2020-06-12 10:51:29 -04:00
Brett Smith
1124842ea7 accrual: Actually use RT caching as intended.
Basically none of the reports were reading or writing the RT link cache
because they didn't instantiate an rtutil.RT properly to do that.
2020-06-11 16:29:18 -04:00
Brett Smith
175ac3bd7a accrual: Outgoing report groups by rt-id. RT#11594. 2020-06-11 15:27:36 -04:00
Brett Smith
8d7a2b1eea accrual: Add AccrualPostings.rt_id property.
This is like the existing attributes, but it only supports the outgoings
report, so don't build it at __init__ time.
2020-06-11 14:22:11 -04:00
Brett Smith
5859421a15 accrual: Remove the consistency checker.
Everything it said was a problem has been done legitimately in our books at
one point or another.

* Variation in contract can happen in different line items of an invoice or
  "group of contractor" situations.

* Variation in cost can happen because one invoice spans a period of time,
  like donation matching programs. There is probably still value in a tool
  that checks to make sure we use consistent rates each day, but that
  affects all kinds of transactions, not just accruals, so it would be
  done better in a separate tool.

* Variation in account happens because invoices legitimately span accrual
  accounts, like donation matching programs with fees payable.

So: it's gone, good riddance.
2020-06-10 16:03:08 -04:00
Brett Smith
6e9a612bb7 accrual: Aging report filters out too-recent accruals. RT#11600. 2020-06-09 17:05:36 -04:00
Brett Smith
948d3a2d14 accrual: Add columns to the aging report. RT#11439.
This adds almost all the metadata that's relevant to accruals.
I considered adding statement, but that cuased rows to get spaced out a lot,
and statement's kind of a low-value column, so I decided against it.

Ultimately I would like to make this configurable but that's for the
future.
2020-06-09 15:59:09 -04:00
Brett Smith
f192d250e7 accrual: More detailed text for "total aged" lines in aging report.
Per bkuhn's request.
2020-06-09 15:04:41 -04:00
Brett Smith
ba8aaaa988 accrual: Aging report uses group since last nonzero. RT#11600.
This makes it consistent with our other reports. The fact that it wasn't
already was basically an oversight.
2020-06-09 14:52:55 -04:00
Brett Smith
a23d075add books: Add Loader.load_none() method. 2020-06-09 09:04:27 -04:00
Brett Smith
cd1b28ae3e cliutil: Add generalized SearchTerm class.
This makes the same filtering easily available to other reporting tools for
consistency.
2020-06-09 09:04:27 -04:00
Brett Smith
e22e63dcca accrual: Make accruals consistent by entity on the accrual side.
It is more common than I realized that we split an invoice by
entity on the accrual side, so this supports that better.

It still disregards inconsistency between accrual entity and payment entity
for reporting purposes, to help keep reporting clean around automatic
imports.

The changes to BaseReport._report shook out because at this point, the group
key is effectively arbitrary and shouldn't be used for any reporting
purposes.
2020-06-05 10:54:35 -04:00
Brett Smith
0b3eb1d1d3 accrual: Inconsistent entity is not an error. 2020-06-05 09:10:48 -04:00
Brett Smith
f8f57428aa accrual: Introduce aging report. RT#10694. 2020-06-03 22:20:37 -04:00
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
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
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
aef00ce83f accrual: Check the consistency of accruals' cost. 2020-05-30 10:35:29 -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
f66460f343 accrual: Outgoing report includes total at cost. 2020-05-28 09:05:18 -04:00
Brett Smith
2c44cc8f50 reports: Add Balance.format() method. 2020-05-28 09:03:19 -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
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
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
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
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