journal: allow prices in balance assertions, but ignore (#824, #958)

This commit is contained in:
Simon Michael 2019-01-25 08:59:37 -08:00
parent b02f81572c
commit 94d5c6f111
2 changed files with 7 additions and 3 deletions

View File

@ -737,9 +737,11 @@ balanceassertionp = do
char '='
exact <- optional $ try $ char '='
lift (skipMany spacenonewline)
a <- amountwithoutpricep <?> "unpriced amount (for a balance assertion or assignment)"
-- allow this amount to have a price, for compatibility, but discard it
a <- amountp <?> "amount (for a balance assertion or assignment)"
let a' = a{aprice=NoPrice}
return BalanceAssertion
{ baamount = a
{ baamount = a'
, baexact = isJust exact
, baposition = sourcepos
}

View File

@ -439,7 +439,9 @@ One workaround is to isolate each commodity into its own subaccount:
### Assertions and prices
Balance assertion (or assignment) amounts should not have a [price](#transaction-prices),
as the meaning of that would be unclear.
as the meaning of that is unclear.
A price written there will be ignored.
(hledger's [close](/manual.html#close) command used to generate balance assertions with prices.)
### Assertions and subaccounts