;doc: journal: clarify account type auto detection
This commit is contained in:
parent
703980524b
commit
32bf6284be
@ -2796,16 +2796,15 @@ but typically not investments or receivables.)
|
|||||||
|
|
||||||
#### Declaring account types
|
#### Declaring account types
|
||||||
|
|
||||||
Generally, to make these reports work you should declare your
|
To make the [balancesheet]/[balancesheetequity]/[cashflow]/[incomestatement] reports work,
|
||||||
top-level accounts and their types,
|
generally you should declare your top-level accounts, and their types.
|
||||||
using [account directives](#declaring-accounts)
|
For each top-level account, write an [account directive](#declaring-accounts),
|
||||||
with `type:` [tags](#tags).
|
with a `type:` [tags](#tags). The tag's value can be any of
|
||||||
|
|
||||||
The tag's value should be one of:
|
|
||||||
`Asset`, `Liability`, `Equity`, `Revenue`, `Expense`, `Cash`,
|
`Asset`, `Liability`, `Equity`, `Revenue`, `Expense`, `Cash`,
|
||||||
`A`, `L`, `E`, `R`, `X`, `C` (all case insensitive).
|
or (for short) `A`, `L`, `E`, `R`, `X`, `C`, all case insensitive.
|
||||||
The type is inherited by all subaccounts except where they override it.
|
The account's type is inherited by all subaccounts, unless they declare a different type.
|
||||||
Here's a complete example:
|
|
||||||
|
An example:
|
||||||
|
|
||||||
```journal
|
```journal
|
||||||
account assets ; type: Asset
|
account assets ; type: Asset
|
||||||
@ -2819,13 +2818,12 @@ account expenses ; type: Expense
|
|||||||
|
|
||||||
#### Auto-detected account types
|
#### Auto-detected account types
|
||||||
|
|
||||||
If you happen to use common english top-level account names, you may
|
As a fallback, when account types are not declared, hledger guesses them
|
||||||
not need to declare account types, as they will be detected
|
by looking for some common english top-level account names:
|
||||||
automatically using the following rules:
|
|
||||||
|
|
||||||
<!-- monospace to work around https://github.com/simonmichael/hledger/issues/1573 -->
|
<!-- monospace to work around https://github.com/simonmichael/hledger/issues/1573 -->
|
||||||
```
|
```
|
||||||
If account's name matches this regular expression: | its type is:
|
If account's name matches this case insensitive regular expression:| its type is:
|
||||||
------------------------------------------------------------------- | ------------
|
------------------------------------------------------------------- | ------------
|
||||||
^assets?(:|$) |
|
^assets?(:|$) |
|
||||||
and does not contain regexp (investment|receivable|:A/R|:fixed) | Cash
|
and does not contain regexp (investment|receivable|:A/R|:fixed) | Cash
|
||||||
@ -2836,8 +2834,11 @@ automatically using the following rules:
|
|||||||
^expenses?(:|$) | Expense
|
^expenses?(:|$) | Expense
|
||||||
```
|
```
|
||||||
|
|
||||||
Even so, explicit declarations may be a good idea, for clarity and
|
For each type, any declaration of an account as that type will disable auto-detection of that type.
|
||||||
predictability.
|
|
||||||
|
This feature helps hledger's high-level reports work out of the box, for new users using english account names.
|
||||||
|
However, explicit account declarations are usually better in the long run,
|
||||||
|
for clarity, predictability, and the other features described here.
|
||||||
|
|
||||||
#### Interference from auto-detected account types
|
#### Interference from auto-detected account types
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user