Discussion:
declaring account types
Simon Michael
2018-09-27 21:44:40 UTC
Permalink
<https://github.com/simonmichael>
I'd welcome your thoughts or review on https://github.com/simonmichael/hledger/pull/877,
which fixes the long-standing dependence on english account names in bs/cf/is.
Here are the commits:


journal: account directives can declare account types <https://github.com/simonmichael/hledger/pull/877/commits/9ad8e8eba9595b9500147ed9388870a56ee0f9b1>
Previously you had to use one of the standard english account names
(assets, liabilities..) for top-level accounts, if you wanted to use
the bs/bse/cf/is commands.
Now, account directives can specify which of the big five categories
an account belongs to - asset, liability, equity, revenue or expense -
by writing one of the letters A, L, E, R or X two or more spaces after
the account name (where the numeric account code used to be).

This might change. Some thoughts influencing the current syntax:
- easy to type and read
- does not require multiple lines
- does not depend on any particular account numbering scheme
- allows more types later if needed
- still anglocentric, but only a little
- could be treated as syntactic sugar for account tags later
- seems to be compatible with (ignored by) current Ledger

The current design permits unlimited account type declarations anywhere
in the account tree. So you could declare a liability account somewhere
under assets, and maybe a revenue account under that, and another asset
account even further down. In such cases you start to see oddities like
accounts appearing in multiple places in a tree-mode report. In theory
the reports will still behave reasonably, but this has not been tested
too hard. In any case this is clearly too much freedom. I have left it
this way, for now, in case it helps with:

- modelling contra accounts ?
- multiple files. I suspect the extra expressiveness may come in handy
when combining multiple files with account type declarations,
rewriting account names, apply parent accounts etc.
If we only allowed type declarations on top-level accounts, or
only allowed a single account of each type, complications seem likely.
bs/bse/cf/is: use account type declarations if any <https://github.com/simonmichael/hledger/pull/877/commits/9f77f417a31ed95152dc6892cf7a3336832f1815>
These commands now detect the account types declared by account directives.
Whenever such declarations are not present, built-in regular expressions
are used, as before.
--
You received this message because you are subscribed to the Google Groups "hledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hledger+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Simon Michael
2018-09-27 21:58:36 UTC
Permalink
Post by Simon Michael
<https://github.com/simonmichael>
I'd welcome your thoughts or review on https://github.com/simonmichael/hledger/pull/877 <https://github.com/simonmichael/hledger/pull/877>,
which fixes the long-standing dependence on english account names in bs/cf/is.
journal: account directives can declare account types <https://github.com/simonmichael/hledger/pull/877/commits/9ad8e8eba9595b9500147ed9388870a56ee0f9b1>
Previously you had to use one of the standard english account names
(assets, liabilities..) for top-level accounts, if you wanted to use
the bs/bse/cf/is commands.
Now, account directives can specify which of the big five categories
an account belongs to - asset, liability, equity, revenue or expense -
by writing one of the letters A, L, E, R or X two or more spaces after
the account name (where the numeric account code used to be).
- easy to type and read
- does not require multiple lines
- does not depend on any particular account numbering scheme
- allows more types later if needed
- still anglocentric, but only a little
- could be treated as syntactic sugar for account tags later
- seems to be compatible with (ignored by) current Ledger
The current design permits unlimited account type declarations anywhere
in the account tree. So you could declare a liability account somewhere
under assets, and maybe a revenue account under that, and another asset
account even further down. In such cases you start to see oddities like
accounts appearing in multiple places in a tree-mode report. In theory
the reports will still behave reasonably, but this has not been tested
too hard. In any case this is clearly too much freedom. I have left it
- modelling contra accounts ?
- multiple files. I suspect the extra expressiveness may come in handy
when combining multiple files with account type declarations,
rewriting account names, apply parent accounts etc.
If we only allowed type declarations on top-level accounts, or
only allowed a single account of each type, complications seem likely.
bs/bse/cf/is: use account type declarations if any <https://github.com/simonmichael/hledger/pull/877/commits/9f77f417a31ed95152dc6892cf7a3336832f1815>
These commands now detect the account types declared by account directives.
Whenever such declarations are not present, built-in regular expressions
are used, as before.
I forgot to provide a clear example. The idea is you declare the types of your five top-level accounts. In english, the standard account names are recognised automatically so this would be redundant, but you could write:

; account types are ALERX. At least two spaces between account name and type.
account assets A
account liabilities L
account equity E
account revenues R
account expenses X

While in french, you could write, if you were using names from https://fr.wikipedia.org/wiki/Plan_comptable_g%C3%A9n%C3%A9ral_(France)#Cadre_comptable :

account Comptes de capitaux L
account Comptes d'immobilisations A
account ??? E
account Comptes de produits R
account Comptes de charges X

I'm not sure where Equity fits in the french chart of accounts. Does this point out a weakness in this ALERX scheme ?
--
You received this message because you are subscribed to the Google Groups "hledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hledger+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...