;doc: clarify how auto postings work

This commit is contained in:
Simon Michael 2023-12-21 15:18:15 -10:00
parent 095f65d9b4
commit 6a2e30897f

View File

@ -2369,16 +2369,21 @@ So,
## Auto postings ## Auto postings
The `=` directive declares a rule for generating temporary extra postings The `=` directive declares a rule for generating temporary extra postings on transactions.
on transactions. Wherever the rule matches an existing posting, it can When the `--auto` flag is used, wherever the `=` rule matches an existing posting,
add one or more companion postings below that one, optionally influenced it will generate a new companion posting (or several) below it.
by the matched posting's amount. This can be useful for generating Optionally the generated posting amount(s) can depend on the matched posting's amount.
tax postings with a standard percentage, for example. This can be useful for generating tax postings with a standard percentage, for example.
Note that depending on generated data is not ideal for financial records Note these generated postings exist only for the duration of the report, and only when hledger is run with the `--auto` flag.
(it's less portable, less future-proof, less auditable by others, They affect the report calculations and output but they are not saved in the journal file by hledger.
and less robust, since other features like balance assertions will depend
on using or not using `--auto`). Also note that depending fully on this kind of generated data has some drawbacks -
it's less portable, less future-proof, less auditable by others, and less robust
(since other features like balance assertions will depend on whether you use or don't use `--auto`).
An alternative is to use auto postings in "one time" fashion -
use them to help build a complex journal entry, view it with `hledger print --auto`,
and then copy that output into the journal file to make it permanent.
An auto posting rule looks a bit like a transaction: An auto posting rule looks a bit like a transaction:
```journal ```journal