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 | ||||
|         (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 | ||||
|         -- (unless it's a multiplier in an automated posting) | ||||
|         defcs <- getDefaultCommodityAndStyle | ||||
|         let (c,s) = case defcs of | ||||
|               Just (defc,defs) -> (defc, defs{asprecision=max (asprecision defs) prec}) | ||||
|               Nothing          -> ("", amountstyle{asprecision=prec, asdecimalpoint=mdec, asdigitgroups=mgrps}) | ||||
|         let (c,s) = case (mult, defcs) of | ||||
|               (False, Just (defc,defs)) -> (defc, defs{asprecision=max (asprecision defs) prec}) | ||||
|               _ -> ("", amountstyle{asprecision=prec, asdecimalpoint=mdec, asdigitgroups=mgrps}) | ||||
|         return $ Amount c (sign q) NoPrice s mult | ||||
| 
 | ||||
|   -- For reducing code duplication. Doesn't parse anything. Has the type | ||||
|  | ||||
| @ -72,29 +72,22 @@ D $1,000.0 | ||||
| 
 | ||||
| >>>=0 | ||||
| 
 | ||||
| # 6. A default commodity should not disrupt automated posting amounts. | ||||
| #hledger -f- print --auto | ||||
| #<<< | ||||
| #commodity 1,000.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 | ||||
| # | ||||
| #>>> | ||||
| #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 | ||||
| # | ||||
| #>>>= | ||||
| # 6. A default commodity should not affect parsing of  | ||||
| # automated posting multiplier amounts. | ||||
| hledger -f- print --auto | ||||
| <<< | ||||
| D $1000. | ||||
| 
 | ||||
| = a | ||||
|   (b)  *2 | ||||
| 
 | ||||
| 2018/1/1 | ||||
|   (a)  €1 | ||||
| 
 | ||||
| >>> | ||||
| 2018/01/01 | ||||
|     (a)              €1 | ||||
|     (b)              €2 | ||||
| 
 | ||||
| >>>= | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user