mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-18 17:57:11 +03:00
fix: infer amountless unbalanced virtual postings as zero
They were effectively zero already, but print always showed them with no amount, even with -x, which was unclear.
This commit is contained in:
parent
e832c344c1
commit
4a61caefd7
@ -241,6 +241,7 @@ transactionInferBalancingAmount styles t@Transaction{tpostings=ps}
|
||||
minferredamt = case ptype p of
|
||||
RegularPosting | not (hasAmount p) -> Just realsum
|
||||
BalancedVirtualPosting | not (hasAmount p) -> Just bvsum
|
||||
VirtualPosting | not (hasAmount p) -> Just 0
|
||||
_ -> Nothing
|
||||
in
|
||||
case minferredamt of
|
||||
|
@ -32,18 +32,16 @@ $ hledger -f- print
|
||||
2010/1/1 x
|
||||
[a] 10
|
||||
[b]
|
||||
$ hledger -f- print
|
||||
$ hledger -f- print -x
|
||||
> //
|
||||
|
||||
# 5. real and balanced virtual postings are balanced separately, and multiple blank virtuals are ok
|
||||
# 5. real and balanced virtual postings are balanced separately, and multiple amountless virtuals are ok
|
||||
<
|
||||
2010/1/1 x
|
||||
a 1
|
||||
b
|
||||
[e] 10
|
||||
[f]
|
||||
(c)
|
||||
(d)
|
||||
$ hledger -f- balance --tree
|
||||
1 a
|
||||
-1 b
|
||||
@ -51,3 +49,17 @@ $ hledger -f- balance --tree
|
||||
-10 f
|
||||
--------------------
|
||||
0
|
||||
|
||||
# 6. Amountless unbalanced postings are always inferred as zero.
|
||||
<
|
||||
2023-01-01
|
||||
(a)
|
||||
(b)
|
||||
(c)
|
||||
$ hledger -f- print -x
|
||||
2023-01-01
|
||||
(a) 0
|
||||
(b) 0
|
||||
(c) 0
|
||||
|
||||
>=
|
||||
|
Loading…
Reference in New Issue
Block a user