On 03/01/2016 01:21 PM, Paggas wrote:
> Hello ledger mailing list!
> 
> I've just noticed a possible bug in ledger.  The idea is that, when there 
> is a null-amount posting which balances multiple commodities in the 
> transaction, any automatic transactions that get activated on that posting 
> will only run for one of the commodities.

Perfect timing! I just ran into the same issue last night, and prepared an
example file, but you beat me to sending it :)

Here's the file I prepared. I am circumventing it by splitting each transaction
with multiple commodities to multiple transactions with a single commodity in 
each.


---- automated.dat ------
;
; I have two commodities defined, each priced at $1:
;
P 2016-01-01 00:00:00 ABC $1
P 2016-01-01 00:00:00 DEF $1

; And I  defined an automated transaction  to add a tax  amount to the
; bill, while  increasing my  tax liability, every time  I use  the tax
; tag:
;
= %/tax/
    $account                                    0.05
    liabilities:tax                            -0.05

;
; These two transactions  from February do exactly what I  want. $5 is
; added to X, and the liabilities:tax gets additional negative $5 with
; each transaction
;
2016-02-01 foo
    X                                                    ; :tax:
    Y                                           -100 ABC

2016-02-01 foo
    X                                                    ; :tax:
    Z                                           -100 DEF

;
; with the following transaction, X is  increased by $200, so I expect
; my tax  liability to  grow by  $10, but  in fact,  it only  grows by
; $5. As  if only one  of the commodities  is "seen" by  the automated
; transaction, and the other is ignored.
;
2016-03-01 bar
    X                                                    ; :tax:
    Y                                           -100 ABC
    Z                                           -100 DEF


;
; Here are the generated transactions:
;
comment

$ ledger -f automated.dat  print --generated
2016/02/01 foo
    X                                            100 ABC  ; :mytag:
    Y                                           -100 ABC
    X                                              5 ABC
    liabilities:tax                               -5 ABC

2016/02/01 foo
    X                                            100 DEF  ; :mytag:
    Z                                           -100 DEF
    X                                              5 DEF
    liabilities:tax                               -5 DEF

2016/03/01 bar
    X                                            100 ABC  ; :mytag:
    Y                                           -100 ABC
    Z                                           -100 DEF
    X                                            100 DEF
    X                                              5 ABC
    liabilities:tax                               -5 ABC

;
; and the balance  report shows tax liability of -$15,  instead of the
; expected $-20:
;

$ ledger -f automated.dat bal -H
                $415  X
               $-200  Y
               $-200  Z
                $-15  liabilities:tax
--------------------
                   0

end comment

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to