mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-29 05:11:33 +03:00
when adding, the balancing amount is a more useful default
This commit is contained in:
parent
468955a563
commit
522a1f4c2a
@ -112,7 +112,8 @@ getPostings bestmatchps enteredps = do
|
||||
where Just ps = bestmatchps
|
||||
defaultaccount = maybe Nothing (Just . paccount) bestmatch
|
||||
validateaccount = Just $ \s -> not $ null s
|
||||
defaultamount = maybe Nothing (Just . show . pamount) bestmatch
|
||||
defaultamount | n==1 = maybe Nothing (Just . show . pamount) bestmatch -- previously used amount
|
||||
| otherwise = Just $ show $ negate $ sum $ map pamount enteredps -- balancing amount
|
||||
validateamount = Just $ \s ->
|
||||
(null s && (not $ null enteredps)) ||
|
||||
(isRight $ parse (someamount>>many spacenonewline>>eof) "" s)
|
||||
|
Loading…
Reference in New Issue
Block a user