Commit graph

14 commits

Author SHA1 Message Date
Brett Smith
51eee8ec8f meta_entity: Don't set transaction metadata when payee is None. RT#12913 2020-11-04 13:43:54 -05:00
Brett Smith
8bc17dbf4a meta_entity: Set metadata when entity comes from payee. RT#12525
This makes it easier to write bean-queries, since you don't have to check
two places for the "real" entity.
2020-09-10 16:06:43 -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
b8d76ec5a0 meta_entity: Don't validate entries out of date range. 2020-05-19 10:30:50 -04:00
Brett Smith
56b644f1db meta_entity: More battle testing.
See the test cases for examples of real entities in the books
that we should accept for now.
2020-05-06 10:26:25 -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
9f0c30738d plugin: Most validations skip opening balance transactions. RT#10642. 2020-04-09 15:12:04 -04:00
Brett Smith
0413fed8b9 meta_entity: Use payee as entity when metadata not available. RT#10529. 2020-04-06 16:03:56 -04:00
Brett Smith
c712105bed Revise chart of accounts used throughout.
The main impetus of this change is to rename accounts that were outside
Beancount's accepted five root accounts, to move them into that
structure. This includes:

  Accrued:*Payable: → Liabilities:Payable:*
  Accrued:*Receivable: → Assets:Receivable:*
  UneanedIncome:* → Liabilities:UnearnedIncome:*

Note the last change did inspire in a change to our validation rules. We no
longer require income-type on unearned income, because it's no longer
considered income at all. Once it's earned and converted to an Income
account, that has an income-type of course.

This did inspire another rename that was not required, but
provided more consistency with the other account names above:

  Assets:Prepaid* → Assets:Prepaid:*

Where applicable, I have generally extended tests to make sure one of each
of the five account types is tested. (This mostly meant adding an Equity
account to the tests.) I also added tests for key parts of the hierarchy,
like Assets:Receivable and Liabilities:Payable, where applicable.

As part of this change, Account.is_real_asset() got renamed to
Account.is_cash_equivalent(), to better self-document its purpose.
2020-04-03 10:34:10 -04:00
Brett Smith
3e20b863e0 test_meta_entity: Test more punctuation as invalid values. 2020-04-01 14:13:36 -04:00
Brett Smith
499f18ff62 meta_entity: Adjust what entities are allowed based on today's books.
See the comments throughout for more discussion about what cases are
or aren't allowed, and why.
2020-04-01 13:38:37 -04:00
Brett Smith
3a4c8526b2 meta_entity: Not required for Equity accounts. 2020-03-31 15:04:15 -04:00
Brett Smith
2cb131423f errors: Redo InvalidMetadataError.
This needs to be generally usable for transactions.
2020-03-28 09:47:40 -04:00
Brett Smith
ad268f049d meta_entity: Start hook. 2020-03-21 13:53:33 -04:00