Skip to content

Commit

Permalink
print: omit the last posting amount, as we used to #465, #442
Browse files Browse the repository at this point in the history
This avoids printing invalid journal format for entries where an implicit amount has multiple commodities.
  • Loading branch information
simonmichael committed Jan 10, 2017
1 parent 4abd029 commit 29183e7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hledger/Hledger/Cli/Print.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ printEntries opts@CliOpts{reportopts_=ropts} j = do
_ -> (entriesReportAsText, ropts)
writeOutput opts $ render $ entriesReport ropts' q j

-- | Render journal entries (transactions) as a string, which should be valid journal format.
entriesReportAsText :: EntriesReport -> String
entriesReportAsText items = concatMap showTransactionUnelided items
entriesReportAsText items = concatMap showtxn items
where
showtxn = showTransaction

-- XXX
-- tests_showTransactions = [
Expand Down

2 comments on commit 29183e7

@ony
Copy link
Collaborator

@ony ony commented on 29183e7 Jan 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can't solve #465 . example:

2017-01-07 buy food
    expenses:food   20 usd @ 1.30 cad
    assets:usd     -20 usd
    income:currency
    expenses:fee     3 usd

Results in

2017/01/07 buy food
    expenses:food    20 usd @ 1.30 cad
    assets:usd                 -20 usd
                            -26.00 cad
    income:currency             17 usd
    expenses:fee

And I don't really like blindly dropping amount carefully written by user.

@simonmichael
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh you're right, thank you. Let's continue discussion on #465.

Please sign in to comment.