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

auto postings break redundant equity/cost detection and transaction balancing #2110

Closed
moben opened this issue Nov 7, 2023 · 1 comment
Closed
Labels
A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. journal The journal file format, and its features.

Comments

@moben
Copy link

moben commented Nov 7, 2023

This minimal example is balanced if --auto is not passed, but reported as unbalanced with --auto, despite the auto posting rule not applying to any of the postings in the transaction afaict:

2023-11-01 * conversion posting
    assets:shares       7 TEST @@ 50.00€
    equity:conversion  -7 TEST
    equity:conversion  50.00€
    equity:opening    -50.00€ 

= expenses:foobar
    expenses:foobar  *-1
    expenses:foo  *0.5
    liabilities:bar  *0.5
% hledger print -f auto_equity_conversion_bug_2110.journal
2023-11-01 * conversion posting
    assets:shares        7 TEST @@ 50.00€
    equity:conversion             -7 TEST
    equity:conversion              50.00€
    equity:opening                -50.00€
% hledger print --auto -f auto_equity_conversion_bug_2110.journal
hledger: Error: /...../auto_equity_conversion_bug_2110.journal:1-5:
1 | 2023-11-01 * conversion posting
  |     assets:shares        7 TEST @@ 50.00€
  |     equity:conversion             -7 TEST
  |     equity:conversion              50.00€
  |     equity:opening                -50.00€

This multi-commodity transaction is unbalanced.
The real postings' sum should be 0 but is: -7 TEST, 50.00€
Consider adjusting this entry's amounts, adding missing postings,
or recording conversion price(s) with @, @@ or equity postings.

Tested with 1.30, 1.31 and master, all running on Linux (NixOS unstable).

If I remove the conversion postings it works, even with --infer-equity (and of course it works without the auto posting). The manual mentions that transactions need to be balanced before and after auto postings are applied, but I think that's the case here as the auto posting rule doesn't even match anything?

@moben moben added the A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. label Nov 7, 2023
@simonmichael simonmichael added the journal The journal file format, and its features. label Nov 7, 2023
@simonmichael
Copy link
Owner

Good catch! Thank you, fixed in master.

@simonmichael simonmichael changed the title auto postings break equity conversion balance auto postings break redundant equity/cost detection and transaction balancing Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. journal The journal file format, and its features.
Projects
None yet
Development

No branches or pull requests

2 participants