Skip to content
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

Add @ entries if ledger can't do implicit conversion #22

Closed
tbm opened this issue Oct 23, 2020 · 4 comments
Closed

Add @ entries if ledger can't do implicit conversion #22

tbm opened this issue Oct 23, 2020 · 4 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@tbm
Copy link
Collaborator

tbm commented Oct 23, 2020

Converting this to ledger works fine:

2020-10-23 * "Test"
    Assets:Property                   0.1 FOO {300.00 EUR}
    Assets:Property                   0.2 BAR {200.00 EUR}
    Equity:Opening-Balance

But if we change it to

2020-10-23 * "Test"
    Assets:Property                   0.1 FOO {300.00 EUR, 2020-10-22}
    Assets:Property                   0.2 BAR {200.00 EUR}
    Equity:Opening-Balance

we get:

0.2 BAR {200.000 EUR}
         -70.000 EUR
0.1 FOO {300.000 EUR} [20-Oct-22]
Amount to balance against:
0.2 BAR {200.000 EUR}
0.1 FOO {300.000 EUR} [20-Oct-22]
Error: Transaction does not balance

This is because the date make it not just EUR. (I wonder if this is a bug in ledger or not.)

I need to think about the different scenarios but it would be good to deal with this somehow.

@tbm tbm added the enhancement New feature or request label Oct 23, 2020
@tbm tbm self-assigned this Oct 23, 2020
@tbm tbm added this to the 1.3 milestone Oct 23, 2020
@tbm
Copy link
Collaborator Author

tbm commented Nov 12, 2020

The example actually works fine. You have to add -70.00 EUR to the other posting for it to fail:

2020-10-23 * "Test"
    Assets:Property                   0.1 FOO {300.00 EUR, 2020-10-22}
    Assets:Property                   0.2 BAR {200.00 EUR}
    Equity:Opening-Balance         -70.00 EUR

So this is a bit complicated because the requirement to add @ depends on a number of factors.

@tbm
Copy link
Collaborator Author

tbm commented Nov 12, 2020

Remove the lot date and you get the same error.

@tbm
Copy link
Collaborator Author

tbm commented Nov 12, 2020

so the question is whether ledger can do an implicit conversion or not.

@tbm tbm changed the title If lot has info, ledger needs @ conversion to currency Add @ entries if ledger can't do implicit conversion Nov 13, 2020
@tbm
Copy link
Collaborator Author

tbm commented Nov 13, 2020

There's actually some code that deals with this already:

              # Figure out if we need to insert a price on a posting held at cost.
              # See https://groups.google.com/d/msg/ledger-cli/35hA0Dvhom0/WX8gY_5kHy0J
...

but clearly it's not working.

@tbm tbm closed this as completed in d02e876 Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant