From 77f29aeee9cf04831577db525778d3da1d725650 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Mon, 11 Jul 2022 13:43:01 +0100 Subject: [PATCH] imp: errors: balancednoautoconversion: now different from balanced --- hledger-lib/Hledger/Data/Balancing.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hledger-lib/Hledger/Data/Balancing.hs b/hledger-lib/Hledger/Data/Balancing.hs index 2d45c5119..745e45aa5 100644 --- a/hledger-lib/Hledger/Data/Balancing.hs +++ b/hledger-lib/Hledger/Data/Balancing.hs @@ -157,7 +157,14 @@ balanceTransactionHelper bopts t = do if infer_transaction_prices_ bopts then inferBalancingPrices t else t case transactionCheckBalanced bopts t' of [] -> Right (txnTieKnot t', inferredamtsandaccts) - errs -> Left $ transactionBalanceError t' errs + errs -> Left $ transactionBalanceError t' errs' + where + errs' = errs ++ + [ "inference of conversion costs has been disallowed" + | ismulticommodity && not (infer_transaction_prices_ bopts) + ] + where + ismulticommodity = (length $ mconcat $ map (maCommodities . pamount) $ tpostings t') > 1 -- | Generate a transaction balancing error message, given the transaction -- and one or more suberror messages.