Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D should not disrupt automated posting rules #860

Closed
simonmichael opened this Issue Aug 14, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@simonmichael
Copy link
Owner

simonmichael commented Aug 14, 2018

There were a few problems in this example shared by zorzar, and I think one of them is a bug:

commodity EUR
 format 9,999.00 EUR

D 1,000.00 EUR

alias /Assets:Depot:([^:]+):(.*)/ = Assets:Depot:\1

= /^Assets:Depot/
	[Assets:Depot]    -1
	[Assets:Savings]  1

2018/01/01 * Opening
	Assets:Checking  10,000.00 EUR
	Opening:Balance

2018/01/01 * Buying Shares
	Assets:Depot:LyxorACWI:20180101  0.43346 LyxorACWI @@ 100.00 EUR
	Assets:Checking

2018/02/01 * Buying Shares
	Assets:Depot:LyxorACWI:20180201  0.42265 LyxorACWI @@ 100.00 EUR
	Assets:Checking

; Output
; hledger bal --flat --auto
;       -10,000.00 EUR  Assets:Checking
;    0.85611 LyxorACWI  Assets:Depot:LyxorACWI
;       -10,000.00 EUR  Opening:Balance
; --------------------
;       -20,000.00 EUR
;    0.85611 LyxorACWI


; Wanted Output
;       -10,000.00 EUR  Assets:Checking
;    0.85611 LyxorACWI  Assets:Savings
;       -10,000.00 EUR  Opening:Balance
; --------------------
;       -20,000.00 EUR
;    0.85611 LyxorACWI

I suspect the D directive is interacting badly with the automated posting amounts - because they have no symbol it makes them EUR. Without the D they remain LyxorACWI.

commodity EUR
 format 9,999.00 EUR

D 1,000.00 EUR

alias /Assets:Depot:([^:]+):(.*)/ = Assets:Depot:\1

= ^Assets:Depot
	[Assets:Depot]    *-1
	[Assets:Savings]  *1

2018/01/01 * Buying Shares
	Assets:Depot:LyxorACWI:20180101  0.43346 LyxorACWI @@ 100.00 EUR
	Assets:Checking

; actual:
; $ hledger print --auto
; 2018/01/01 * Buying Shares
;     Assets:Depot:LyxorACWI    0.43346 LyxorACWI @@ 100.00 EUR
;     [Assets:Depot]                                  -0.43 EUR
;     [Assets:Savings]                                 0.43 EUR
;     Assets:Checking

; expected, works with D commented out:
; $ hledger print --auto
; 2018/01/01 * Buying Shares
;     Assets:Depot:LyxorACWI     0.43346 LyxorACWI @@ 100.00 EUR
;     [Assets:Depot]            -0.43346 LyxorACWI @@ 100.00 EUR
;     [Assets:Savings]           0.43346 LyxorACWI @@ 100.00 EUR
;     Assets:Checking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.