|
Brett Smith
|
1b7fdf4f3b00
|
4 years ago
|
|
|
|
Brett Smith
|
f21ac740f24c
|
4 years ago
|
|
|
|
Brett Smith
|
8d584734ec0c
|
4 years ago
|
|
|
|
Brett Smith
|
14a87e792b22
|
4 years ago
|
|
data: Move iter_posting into Posting class methods.
As I move into reporting code, having Posting.from_beancount() is handy, and then from_txn() might as well come along for the ride.
|
|
Brett Smith
|
c6dc2d83aca7
|
4 years ago
|
|
data.Amount: Introduce class and simplify code to use it.
See docstring for full rationale. This greatly reduces the need for other plugin code to handle the case of `post.units.number is None`, eliminating the need for entire methods and letting it do plain numeric comparisons.
|
|
Brett Smith
|
c712105bed3c
|
4 years ago
|
|
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.
|
|
Brett Smith
|
1fc9363b26cb
|
4 years ago
|
|
data: Add is_credit() and is_debit() methods to Posting.
The main motivation for this change is to make sure that higher-level code deals with the fact that self.units.number can be None, and has an easy way to do so.
I'm not sure all our code is *currently* doing the right thing for this case, because I'm not sure it will ever actually come up. It's possible that earlier Beancount plugins fill in decimal amounts for postings that are originally loaded with self.units.number=None. I'll have to see later whether this case comes up in reality, and then deal with it if so. For now the safest strategy seems to be that most code should operate when self.units.number is None.
|
|
Brett Smith
|
93feb2f4a3b3
|
4 years ago
|
|
|