Commit graph

237 commits

Author SHA1 Message Date
Brett Smith
f21ac740f2 data: Add Posting.at_cost() method. 2020-06-15 10:16:34 -04:00
Brett Smith
a2ee9c73fe ranges: Start module.
The ledger report wants to use this functionality, so make it available in a
higher-level module.

I took the opportunity to clean up a lot of the surrounding type
declarations. It is less flexible, since it relies on the static list of
types in RangeT, but I don't think the other method actually worked at all
except by cheating with generic Any.
2020-06-15 09:14:42 -04:00
Brett Smith
760e0a8cd9 reports: Add column width styles to BaseODS. 2020-06-14 08:53:27 -04:00
Brett Smith
71d671e493 data: Add Metadata.human_name() classmethod. 2020-06-14 08:53:27 -04:00
Brett Smith
9a7b9de08d test_reports_accrual: Clean imports. 2020-06-13 16:10:52 -04:00
Brett Smith
aff1fc537d reports: Add BaseODS.meta_links_cell() method. 2020-06-12 17:10:25 -04:00
Brett Smith
17c5468a7d reports: ODS links default to using URL as link text. 2020-06-12 16:42:54 -04:00
Brett Smith
4ca188611f rtutil: Add RT.unparse() classmethod. 2020-06-12 15:54:38 -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
52fc0d1b5f reports: Add RelatedPostings.group_by_first_meta_link() method. 2020-06-11 14:01:19 -04:00
Brett Smith
f52ad4fbc1 reports: Add RelatedPostings.first_meta_links() method.
Basically moving this from AccrualPostings into the superclass.
2020-06-11 13:07:14 -04:00
Brett Smith
1cbc9d3dc9 tests: Add _meta_type kwarg to testutil.Posting. 2020-06-11 13:07:14 -04:00
Brett Smith
f76fa35fad reports: RelatedPostings.all_meta_links() returns an iterator.
This preserves order.
2020-06-11 10:46:06 -04:00
Brett Smith
e3dceb601c filters: Add iter_unique() function. 2020-06-11 10:46:06 -04:00
Brett Smith
9c33517583 data: Add Metadata.first_link() method. 2020-06-11 10:44:05 -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
8250f0a8ef filters: Add audit_date() function. 2020-06-10 15:59:56 -04:00
Brett Smith
944c19da8d books: Add date-fetching methods to FiscalYear. 2020-06-10 15:59:56 -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
581046f988 reports: Balance.format() respects tolerance. 2020-06-09 09:04:27 -04:00
Brett Smith
cd1766adcf reports: Balance.__eq__ respects tolerance. 2020-06-09 09:04:27 -04:00
Brett Smith
110e5038e1 reports: Balance.__init__ better handles multiple amounts of same currency.
This is something that should've happened with 3d704e286
but I didn't think of it at the time.
2020-06-09 09:04:27 -04:00
Brett Smith
a23d075add books: Add Loader.load_none() method. 2020-06-09 09:04:27 -04:00
Brett Smith
8d3d7e7ce4 data: Add part slicing methods to Account. 2020-06-09 09:04:27 -04:00
Brett Smith
2b5cb0eca6 cliutil: Add bytes_output() and text_output() functions. 2020-06-09 09:04:27 -04:00
Brett Smith
0581525c98 reports: Add Balance.__pos__() method.
I did this while I was working on normalize_amount_func.
It turns out it's not immediately needed, but it's still nice to have.
2020-06-09 09:04:27 -04:00
Brett Smith
e26dffa214 reports: Add normalize_amount_func() function. 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
0431d15d68 tests: Explain change to accruals.beancount from the last commit. 2020-06-09 09:04:01 -04:00
Brett Smith
8dc6894ce7 accrual: Outgoing report uses first rt-id as primary ticket number.
This makes it consistent with the reporting and our general rule
that the first link is primary.
2020-06-08 16:38:42 -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
39fa977f71 reports: Balance.le/ge_zero returns False when exactly at tolerance. 2020-06-04 10:49:55 -04:00
Brett Smith
95ba1638d2 filters: remove_opening_balance_txn does replacement instead of del. 2020-06-04 09:49:39 -04:00
Brett Smith
5601ece2ac tests: books.Loader tests do more bounds checking. 2020-06-04 09:15:23 -04:00
Brett Smith
2bd3e8b462 books: Loader.from_all() accepts a start FY argument. 2020-06-04 09:03:10 -04:00
Brett Smith
4cba2b2681 reports: Balance has built-in tolerance for zero comparisons. 2020-06-03 22:20:37 -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
d920c5842a reports: Start BaseSpreadsheet class. 2020-06-03 21:24:47 -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
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