hledger/tests/journal/modifiers-928.test
Simon Michael 9e8b1612b0 journal: fix txn modifier multipliers with total-priced amounts (#928)
Transaction modifier multipliers have never multiplied total-priced amounts
correctly (and prior to hledger 1.10, this could generate unbalanced
transactions).

Now, the generated postings in this situation will have unit prices,
and an extra digit of display precision. This helps ensure that
the modified transaction will remain balanced. I'm not sure yet if
it's guaranteed.
2018-11-13 16:35:46 -08:00

65 lines
2.1 KiB
Plaintext

# Issue #928
# Generating auto postings from a unit-priced amount.
<
= ^Expenses:Joint
Expenses:Joint *-1
Liabilities:Joint:Bob *0.5
Liabilities:Joint:Bill *0.5
2018/01/01
Expenses:Joint:Widgets $100.00 @ £0.50
Assets:Joint:Bank -£50.00
$ hledger -f- print --auto
2018/01/01
Expenses:Joint:Widgets $100.00 @ £0.50
Expenses:Joint $-100.00 @ £0.50
Liabilities:Joint:Bob $50.00 @ £0.50
Liabilities:Joint:Bill $50.00 @ £0.50
Assets:Joint:Bank £-50.00
>=0
# Generating auto postings from a total-priced amount.
<
= ^Expenses:Joint
Expenses:Joint *-1
Liabilities:Joint:Bob *0.5
Liabilities:Joint:Bill *0.5
2018/01/01
Expenses:Joint:Widgets $100.00 @@ £50
Assets:Joint:Bank -£50.00
$ hledger -f- print --auto
2018/01/01
Expenses:Joint:Widgets $100.00 @@ £50
Expenses:Joint $-100.00 @ £0.5
Liabilities:Joint:Bob $50.00 @ £0.5
Liabilities:Joint:Bill $50.00 @ £0.5
Assets:Joint:Bank £-50.00
>=0
# Generating auto postings from an implicitly-priced amount. Same as above.
<
= ^Expenses:Joint
Expenses:Joint *-1
Liabilities:Joint:Bob *0.5
Liabilities:Joint:Bill *0.5
2018/01/01
Expenses:Joint:Widgets $100.00
Assets:Joint:Bank -£50.00
$ hledger -f- print --auto
2018/01/01
Expenses:Joint:Widgets $100.00
Expenses:Joint $-100.00 @ £0.5
Liabilities:Joint:Bob $50.00 @ £0.5
Liabilities:Joint:Bill $50.00 @ £0.5
Assets:Joint:Bank £-50.00
>=0