Commit graph

342 commits

Author SHA1 Message Date
Brett Smith
887102ea92 fund: New report. 2020-06-21 18:07:44 -04:00
Brett Smith
baf0b2c5ff ledger: Fix --output-format default help.
This was accidentally carried over from accrual-report.
2020-06-21 11:40:28 -04:00
Brett Smith
42d2002fda reports: Balance.format(None) uses accounting formats. 2020-06-21 11:39:31 -04:00
Brett Smith
5e9e11923e reports: Add account_balances() function. 2020-06-20 22:51:02 -04:00
Brett Smith
6213bc1e5d reports: Add PeriodPostings class.
This is AccountPostings from the ledger report, cleaned up to be more
general.
2020-06-20 19:04:53 -04:00
Brett Smith
7a9bc2da50 reports: Add sort_and_filter_accounts() function.
Extracted from the ledger report.
2020-06-20 09:11:01 -04:00
Brett Smith
5b68312924 tests: Add tests for Balance.copy() tolerance handling.
I wrote the changes to Balance.format() before the dependent changes to
Balance.copy(), so I was sort of counting on them to be implicitly
tested. But they should be explicit.
2020-06-20 09:11:01 -04:00
Brett Smith
7f3a26b555 reports: Balance.format() accepts zero argument.
This change has the same motivation as the recent change to
BaseODS.balance_cell(): try to preserve currency information when it's
available.
2020-06-18 14:07:44 -04:00
Brett Smith
ae974b8e50 reports: Balance.copy() accepts tolerance argument. 2020-06-18 14:06:18 -04:00
Brett Smith
355a48381c reports: Balance.clean_copy() creates new Balance with given tolerance. 2020-06-18 14:05:49 -04:00
Brett Smith
0f7a154ff4 reports: Balance cells try to retain currency on zero balance. 2020-06-18 10:07:10 -04:00
Brett Smith
daf7e12752 ledger: Remove obsoleted hack.
This is no longer necessary now that the plugin enforces proper project
metadata on Equity accounts.
2020-06-18 10:05:37 -04:00
Brett Smith
7441f4ef0c ledger: Correct period totals. RT#11661.
The period totals were reporting the balance of all the loaded postings, not
just the ones in the reporting date range.

Like the accrual report, introduce a RelatedPostings subclass that records
and saves all the information we need at group definition time, to help us
get it consistently right rather than redoing the same math over and over.
2020-06-17 18:25:47 -04:00
Brett Smith
5e295f1024 accrual: Change args.since default.
This default makes more since with the way we're going to stop having
opening balances in open books.
2020-06-17 15:32:08 -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
d7e2ab34b9 meta_project: Force the default project on Equity accounts.
See rationale in comments.
2020-06-17 04:29:17 -04:00
Brett Smith
8b8bdc0225 reports: Add BaseODS.column_style() method.
Use this to provide more consistent column styles throughout the reports.
2020-06-16 22:41:13 -04:00
Brett Smith
cf2833ee20 plugin: Load user configuration file. 2020-06-16 15:10:19 -04:00
Brett Smith
b1f82badf7 config: Get repository directory from config file.
One less thing users have to fiddle with to get set up.
2020-06-16 14:42:09 -04:00
Brett Smith
efe9bd8855 ledger: Change default report dates.
The old defaults were optimized for the audit report.
The new defaults provide more helpful ad hoc reports.
The latter will be run more often and more quickly, so it's
worth optimizing the defaults for them.
2020-06-16 13:31:46 -04:00
Brett Smith
9782e7203a ledger: New reporting module. 2020-06-16 10:18:18 -04:00
Brett Smith
7660700e6c cliutil: Add date_arg() function.
Meant to be used as an argument type.
2020-06-15 18:11:39 -04:00
Brett Smith
4a28596db2 data: bank-statement and tax-statement are link metadata.
Not including them earlier was an oversight.
2020-06-15 18:08:18 -04:00
Brett Smith
582316ae85 data: Add Metadata.report_links() method.
This is just a variant of get_links() that eats TypeError.
Higher-level reporting code often wants it.
2020-06-15 14:19:10 -04:00
Brett Smith
72f58d80d7 reports: BaseODS.currency_cell() sets default style.
It'll be rare we don't want this.
2020-06-15 14:09:42 -04:00
Brett Smith
8333ed8876 reports: Add RelatedPostings.group_by_account() classmethod. 2020-06-15 11:20:30 -04:00
Brett Smith
ccc3a829da reports: Add RelatedPostings.balance_at_cost_by_date() method. 2020-06-15 10:38:26 -04:00
Brett Smith
b2e35d098a reports: Add Balance subtraction methods. 2020-06-15 10:16:34 -04:00
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
44946a061d accrual: Aging report is written to repository path by default.
Opening it here is necessary for repository links to work anyway.
2020-06-12 15:56:29 -04:00
Brett Smith
d6559b572f accrual: Aging report uses RT short links for all RT link text.
Per user request. This is better than saying "Display.html" everywhere.
2020-06-12 15:54:50 -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
2a33e17892 accrual: Clean up comments. 2020-06-12 14:34:41 -04:00
Brett Smith
5706273bbe accrual: Clean up types and imports.
Mostly I wanted to write the documentation about groups, and then
I kept pulling the thread.
2020-06-12 13:24:25 -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