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

Balance Assertion not working with Virual transactions #543

Closed
agarrharr opened this issue Feb 20, 2018 · 3 comments
Closed

Balance Assertion not working with Virual transactions #543

agarrharr opened this issue Feb 20, 2018 · 3 comments
Labels
bug Something isn't working

Comments

@agarrharr
Copy link

agarrharr commented Feb 20, 2018

Here is a simple example of the problem I'm seeing.

2018/01/01 * Opening Balance
    Assets:Checking                                    $100.00
    Equity:Opening Balances

2018/01/01 * Budget
    [Assets:Checking]                                 -$100.00
    [Assets:Budget:Food:Groceries]                      $20.00
    [Assets:Budget:Food:Restaurants]                    $80.00

2018/01/02 * Assertion
    [Assets:Checking]                                  = $0.00
2018/01/02 * Assertion
    Assets:Checking                                  = $100.00

The assertion on the virtual checking account works, but the assertion on Assets:Checking does not. I get this error:

While parsing file "/Users/agarrharr/example.ledger", line 13:
While balancing transaction from "/Users/agarrharr/example.ledger", lines 12-13:
> 2018/01/02 * Assertion
>     Assets:Checking                                  = $100.00
Unbalanced remainder is:
             $100.00
Amount to balance against:
             $100.00
Error: Transaction does not balance
@501st-alpha1
Copy link

Tried the example provided in Ledger 3.1.3-20190331 (which is the current Docker image), and it still failed, so it looks like this wasn't fixed by #552.

@daraul
Copy link
Contributor

daraul commented Jan 17, 2020

I'm getting this error as well. Wasn't sure if it was a bug, or if I'm expected to assert my balance, while considering virtual postings (that seems wrong to me...)

Ledger 3.1.2-20190205, the command-line accounting tool

Copyright (c) 2003-2019, John Wiegley.  All rights reserved.

This program is made available under the terms of the BSD Public License.
See LICENSE file included with the distribution for details and disclaimer.

daraul added a commit to daraul/ledger that referenced this issue Jan 23, 2020
daraul added a commit to daraul/ledger that referenced this issue Feb 22, 2020
Separately from it's virtual one
daraul added a commit to daraul/ledger that referenced this issue Mar 5, 2020
daraul added a commit to daraul/ledger that referenced this issue Mar 5, 2020
Separately from it's virtual one
jwiegley pushed a commit that referenced this issue Mar 5, 2020
jwiegley pushed a commit that referenced this issue Mar 5, 2020
Separately from it's virtual one
@daraul
Copy link
Contributor

daraul commented Mar 10, 2020

Can this issue now be closed? @tbm had some concerns with the PR, but I'm not sure what they are exactly.

/cc @jwiegley

daraul added a commit to daraul/ledger that referenced this issue Mar 10, 2020
Without these changes, whether an account's balance is virtual
or real is not considered when asserting it's balance. This lead
to situations where the user must consider their virtual postings
when attemping to assert the real balance of the account. See
test/regress/543_a.test for that testcase, taken from the original
issue. This commit also includes other, fringe, situations that I
noticed while working on the fix. It essentially just adds a separate
attribute to the account class(?) that hold's the account's "real"
balance, which is only updated when the user attempts an assertion on a
real account. The virtual account's balance is updated the way it always
was.
daraul added a commit to daraul/ledger that referenced this issue Mar 22, 2020
Without these changes, whether an account's balance is virtual
or real is not considered when asserting it's balance. This lead
to situations where the user must consider their virtual postings
when attemping to assert the real balance of the account. See
test/regress/543_a.test for that testcase, taken from the original
issue. This commit also includes other, fringe, situations that I
noticed while working on the fix. It essentially just adds a separate
attribute to the account class(?) that hold's the account's "real"
balance, which is only updated when the user attempts an assertion on a
real account. The virtual account's balance is updated the way it always
was.
@tbm tbm closed this as completed in 0018c88 Apr 5, 2020
dbear496 added a commit to dbear496/ledger-cli that referenced this issue Jul 14, 2023
The balance of virtual accounts reflects postings from the same real 
account, and not vice-versa. The same should be true for postings in the 
same transaction.
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

4 participants