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

Only one posting with null amount allowed per transaction #23

Closed
tbm opened this issue Nov 12, 2020 · 1 comment
Closed

Only one posting with null amount allowed per transaction #23

tbm opened this issue Nov 12, 2020 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@tbm
Copy link
Collaborator

tbm commented Nov 12, 2020

Consider:

2010-01-01 open Assets:Cash
2010-01-01 open Equity:Opening-balance

2020-01-01 * "Opening balance: cash"
  Assets:Cash                                               0.10 EUR
  Assets:Cash                                               1.00 GBP
  Equity:Opening-balance

This leads to:

account Assets:Cash

account Equity:Opening-balance

2020-01-01 * Opening balance: cash
  Assets:Cash                                                      0.10 EUR
  Equity:Opening-balance
  Assets:Cash                                                      1.00 GBP
  Equity:Opening-balance

which leads to:

While parsing file "/home/tbm/src/tbm/beancount2ledger/x", line 11:
Error: Only one posting with null amount allowed per transaction
@tbm tbm added the bug Something isn't working label Nov 12, 2020
@tbm tbm added this to the 1.3 milestone Nov 12, 2020
@tbm
Copy link
Collaborator Author

tbm commented Nov 12, 2020

This was sort of introduced in commit 27dcd7e

Without it, we have:

2020-01-01 * Opening balance: cash
  Assets:Cash                                                      0.10 EUR
  Equity:Opening-balance                                          -0.10 EUR
  Assets:Cash                                                      1.00 GBP
  Equity:Opening-balance                                          -1.00 GBP

so the problem doesn't show up.

tbm added a commit to tbm/beancount2ledger that referenced this issue Nov 13, 2020
If a posting without an amount is given and several amounts would
be added when balancing, beancount will create several postings.
But we ignore the amount on those postings (since they were added
by beancount and not the user), which means we may end up with
two or more postings with no amount, which is not valid.

Therefore, only take *one* posting by looking at the line number.

Fixes beancount#23
@tbm tbm closed this as completed in 283e011 Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant