account directives, subdirectives, tags
We want to add support for an account directive like Ledger's, to:
- increase compatibility with ledger files
- pre-declare account names, providing guidance and optional strict checking
- define additional per-account metadata. For example, the account type (asset, liability, expense..)
julm has got the ball rolling on this.
Related: Chart of Accounts support #50
An actual CoA would include every account that is relevant to you, whether or not you have any entries corresponding to each account. It should also be able to contain all desired details for each account; account number, bank branch addresses, terms, rates, paper-file cross reference, tax GIFI numbers, what have you. These details should not live in specific transactions, but they should be available wherever you need them; as reference to your chosen account structure and to enhance account-specific reports.
https://trello.com/c/uvwd6M8m/102-track-account-types-metadata-50 https://factor.cc/pad/p/hledger http://ledger-cli.org/3.0/doc/ledger3.html#Command-Directives http://plaintextaccounting.org/quickref/#h.3v5cafffbbft
Goals:
- [x] parse account directives, somewhat compatible with Ledger's, in journal files
- [x] allow account type (asset/liability/equity/revenue/expense) to be set in account directives (#523)
- [x] enhance the
accountsand/ortagscommands to also show declared accounts and account tags - [x] allow (queryable) tags in account directives (#1817, #1073)
- [ ] implement Ledger subdirectives: alias (#1284)
- [ ] decide how to align with Beancount's dated open directive (#1389)
Would you accept a PR that implements the alias subdirective?
@mildred I've been away from this for a while but if you want to do it, yes I guess so. I don't have a feel for how useful it is compared to the existing alias directive.
Thank you, I wanted to learn Haskell a bit. The subdurective can be replaced by the alias directive, but when all accounts are declared up front it provides a better way to present the information.
There is something else, the alias directive ends at the end of file. This is a problem for me as I wanted to declare my account hierarchy in a separate accounts.ledger file included from the top level file. but the alias directives does not have any effect because of that. (See #1007)
Would it make sense to have the alias subdirective scope to continue after the end of file or not ?
If the account directive does not span past the end of file (as for alias) the previous comment makes no sense.
I’ve recently written (sorry I forget where) about why it ends at the file end. Maybe #510 is one of them.
Can you put your aliases in the top level file ?
Added to the FAQ: https://hledger.org/FAQ.html#why-do-some-directives-not-affect-other-files-why-cant-i-put-account-aliases-in-an-included-file
Seems there are good reasons for this behaviour. Yes, top level file seems the correct thing to do.