Visitar URL original
auto postings break redundant equity/cost detection and transaction balancing · Issue #2110 · hledgerorg/hledger · GitHub
Skip to content

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

Closed

Description

@moben

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?

Activity

  1. added
    A-BUGSomething wrong, confusing or sub-standard in the software, docs, or user experience.
    on Nov 7, 2023
  2. added a commit that references this issue on Nov 7, 2023
    54b4c2e
  3. simonmichael commented on Nov 7, 2023

    @simonmichael
    Member

    Good catch! Thank you, fixed in master.

  4. changed the title [-]auto postings break equity conversion balance[/-] [+]auto postings break redundant equity/cost detection and transaction balancing[/+] on Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-BUGSomething wrong, confusing or sub-standard in the software, docs, or user experience.journalThe journal file format, and its features.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions