lib: D should not affect automated posting multiplier amounts (fix #860)
This commit is contained in:
		
							parent
							
								
									13436637c6
								
							
						
					
					
						commit
						1d775a7a9c
					
				| @ -560,10 +560,11 @@ amountwithoutpricep = do | |||||||
|         suggestedStyle <- getDefaultAmountStyle |         suggestedStyle <- getDefaultAmountStyle | ||||||
|         (q,prec,mdec,mgrps) <- lift $ interpretNumber numRegion suggestedStyle ambiguousRawNum mExponent |         (q,prec,mdec,mgrps) <- lift $ interpretNumber numRegion suggestedStyle ambiguousRawNum mExponent | ||||||
|         -- if a default commodity has been set, apply it and its style to this amount |         -- if a default commodity has been set, apply it and its style to this amount | ||||||
|  |         -- (unless it's a multiplier in an automated posting) | ||||||
|         defcs <- getDefaultCommodityAndStyle |         defcs <- getDefaultCommodityAndStyle | ||||||
|         let (c,s) = case defcs of |         let (c,s) = case (mult, defcs) of | ||||||
|               Just (defc,defs) -> (defc, defs{asprecision=max (asprecision defs) prec}) |               (False, Just (defc,defs)) -> (defc, defs{asprecision=max (asprecision defs) prec}) | ||||||
|               Nothing          -> ("", amountstyle{asprecision=prec, asdecimalpoint=mdec, asdigitgroups=mgrps}) |               _ -> ("", amountstyle{asprecision=prec, asdecimalpoint=mdec, asdigitgroups=mgrps}) | ||||||
|         return $ Amount c (sign q) NoPrice s mult |         return $ Amount c (sign q) NoPrice s mult | ||||||
| 
 | 
 | ||||||
|   -- For reducing code duplication. Doesn't parse anything. Has the type |   -- For reducing code duplication. Doesn't parse anything. Has the type | ||||||
|  | |||||||
| @ -72,29 +72,22 @@ D $1,000.0 | |||||||
| 
 | 
 | ||||||
| >>>=0 | >>>=0 | ||||||
| 
 | 
 | ||||||
| # 6. A default commodity should not disrupt automated posting amounts. | # 6. A default commodity should not affect parsing of  | ||||||
| #hledger -f- print --auto | # automated posting multiplier amounts. | ||||||
| #<<< | hledger -f- print --auto | ||||||
| #commodity 1,000.00 EUR | <<< | ||||||
| # | D $1000. | ||||||
| #D 1,000.00 EUR | 
 | ||||||
| # | = a | ||||||
| #alias /Assets:Depot:([^:]+):(.*)/ = Assets:Depot:\1 |   (b)  *2 | ||||||
| # | 
 | ||||||
| #= ^Assets:Depot | 2018/1/1 | ||||||
| #  [Assets:Depot]    *-1 |   (a)  €1 | ||||||
| #  [Assets:Savings]  *1 | 
 | ||||||
| # | >>> | ||||||
| #2018/01/01 * Buying Shares | 2018/01/01 | ||||||
| #  Assets:Depot:LyxorACWI:20180101  0.43346 LyxorACWI @@ 100.00 EUR |     (a)              €1 | ||||||
| #  Assets:Checking |     (b)              €2 | ||||||
| # | 
 | ||||||
| #>>> | >>>= | ||||||
| #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 |  | ||||||
| # |  | ||||||
| #>>>= |  | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user