-
-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong multi-currency printing #465
Comments
Thanks for the report. Yes, print's output is not always valid journal format, which is a pity. Postings where the amount is implicit can have a multi-commodity amount. To show this in valid journal format would mean showing one posting per commodity, like this:
Should the print command do this ? Ie, show a journal entry which is not what you wrote, to get valid journal output ? Or, it could just leave the amount implicit as it was in the first place ?
It originally did this, but I had some reason to change it - clarity when troubleshooting ? See also #442 . |
Let's revert to the old behaviour and see what happens. I think this means print will show all entries with no explicit amount on the last posting - whether you wrote one in the journal entry or not. So eg if you did write all amounts explicitly:
print will show
Maybe this is ok. Maybe we'll need a |
This avoids printing invalid journal format for entries where an implicit amount has multiple commodities.
And I shouldn't have pushed that before updating tests. Oh well. |
Also, as @ony pointed out this doesn't fix the problem. Eg we still have:
Discussing a bit on IRC. |
- Make output of print to be a valid journal - Partially reverts 419f5f2 Fixes simonmichael#465
Thanks for the quick action! For my purposes it would be enough if there was a canonical format that I can thread through multiple calls. Like |
Yeah. The CSV output of print has one record per posting, while we expect CSV input to have one record per transaction, so doing that with CSV sounds hard. |
Thanks for the PR! I believe this issue is now resolved in master. |
Thanks! I will try it out soon. |
Though journal now is valid I've got strange output for journal
I would understand if the output would look like:
|
I see, it looks like the balancing amount inferring function is missing an opportunity to combine same-commodity amounts. It's normal for the inferred balancing amount to be converted to the price's commodity ($) by the way, hledger always does that for similarity with Ledger/convenience reasons I don't fully recall. |
This fixes issue exposed by a fix for simonmichael#465
This fixes issue exposed by a fix for #465
Looks like it works for me now! Thanks! |
I'm not sure if I'm doing the right thing, but I think I've found a problem. I'm trying to use a currency trading account like this:
hledger print
yields:Using
hledger print -O csv
, I can understand how this is meant:However, in this case
print
is not idempotent. –hledger print | hledger -f- print
yields:This looks wrong.
The text was updated successfully, but these errors were encountered: