From f9e113c9abcf6af647f4a5657be02af7c523d9c5 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sat, 30 Dec 2017 19:05:00 -0800 Subject: [PATCH] print: -B shows converted amounts again, as in 1.1, even without -x. #551 (Simon Michael, Mykola Orliuk) --- hledger/Hledger/Cli/Commands/Print.hs | 11 +++++++++-- hledger/hledger_commands.m4.md | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/hledger/Hledger/Cli/Commands/Print.hs b/hledger/Hledger/Cli/Commands/Print.hs index 5756c1a32..cd60a601f 100644 --- a/hledger/Hledger/Cli/Commands/Print.hs +++ b/hledger/Hledger/Cli/Commands/Print.hs @@ -66,8 +66,15 @@ printEntries opts@CliOpts{reportopts_=ropts} j = do entriesReportAsText :: CliOpts -> EntriesReport -> String entriesReportAsText opts = concatMap (showTransactionUnelided . gettxn) where - gettxn | boolopt "explicit" $ rawopts_ opts = id -- use the fully inferred/explicit txn - | otherwise = originalTransaction -- use the original txn (more or less) + gettxn | useexplicittxn = id -- use the fully inferred/explicit txn + | otherwise = originalTransaction -- use the original as-written txn, more or less + -- Original vs inferred transactions/postings were causing problems here, disabling -B (#551). + -- Use the explicit one if -B or -x are active. + -- This passes tests; does it also mean -B sometimes shows missing amounts unnecessarily ? + useexplicittxn = or + [ boolopt "explicit" $ rawopts_ opts + , cost_ $ reportopts_ opts + ] -- Replace this transaction's postings with the original postings if any, but keep the -- current possibly rewritten account names. diff --git a/hledger/hledger_commands.m4.md b/hledger/hledger_commands.m4.md index 2395bd109..23bc6e2f5 100644 --- a/hledger/hledger_commands.m4.md +++ b/hledger/hledger_commands.m4.md @@ -548,7 +548,7 @@ Note, `-x` will cause postings with a multi-commodity amount will be split into multiple single-commodity postings, for valid journal output. With `-B`/`--cost`, amounts with [transaction prices](/journal.html#transaction-prices) -are converted to cost using that price. +are converted to cost using that price. This can be used for troubleshooting. With `-m`/`--match` and a STR argument, print will show at most one transaction: the one one whose description is most similar to STR, and is most recent. STR should contain at