Ok, I tried a few more things, and I think I know why this is happening.
Note that if we add 'CHF' to the balance, it seems to ignore the other
currencies (which were also checked when simply using '0').
Here is another snippet to illustrate my point, with some references in
comments (e.g. #1):
2013/12/01 * Initial State
Crédit:Viseca:MasterCard P1 -618.50 CHF
Crédit:Viseca:MasterCard P2 -52.10 CHF
Equity:Opening Balances
2013/12/15 * Buy Some Chocolate
Dépenses:Nourriture 19.00 EUR *; #1*
Crédit:Viseca:MasterCard P1
2013/12/15 * Buy Some Chocolate
Crédit:Viseca:MasterCard P1 19.00 EUR *; #2*
Recettes:Erreurs
2013/12/23 * Facture Viseca
Crédit:Viseca:MasterCard P2 52.10 CHF = 0 *;
#3*
Crédit:Viseca:MasterCard P1 618.50 CHF = 0 *;
#4*
Dépenses:Frais:Gestion Comptes 1.50 CHF
Crédit:Viseca -672.10 CHF
2014/01/03 * Facture Viseca
Crédit:Viseca 672.10 CHF = 0
Actif:Comptes:CP courant
This is running on ubuntu 18.04
$ ledger --version
Ledger 3.1.2-20160801, the command-line accounting tool
Copyright (c) 2003-2016, John Wiegley. All rights reserved.
- without the transactions on 2013/12/15, all is fine, with or without the
'CHF' suffix on lines #3 and #4.
- if I add the transactions of 2013/12/15, the balance fails if I use
'EUR' in #1 and #2 (even though they balance out), but works again if those
transactions are also in CHF.
- if I use 'EUR' in #1 and #2, and balance with '= 0 CHF' in #4 then it
works again, but it still works even if the amounts in EUR do not cancel
out. #3 works fine in this case too, it has seen only a single currency.
So the balance assertion does not do the right thing if the account has
seen some transaction in several currencies, even if all the amounts end up
at zero.
Also, the error message seems to round things to the nearest integer value,
which is unhelpful at times.
Is there a way to assert that an account is at 0 overall, independent of
currency ? Also related, I don't know how to assert that an account is at
"0 CHF + 19.00 EUR". If that works, it could be added to the documentation.
I think these balances are a very neat functionality, as with sorting
files, if I add a transaction with e.g. the wrong year, it will move it far
too early, and would then be caught by the suddenly wrong balance. Using
git, I can then easily find which transaction went too far into the past
due to such a typo.
Thanks,
Pascal
On Thu, Jun 28, 2018 at 5:59 AM, Colin Dean <[email protected]> wrote:
> Running your original snippet under 3.1.1-20160111 from Homebrew, it
> passes.
>
> Running under HEAD of next branch, it fails.
>
> If I add "CHF" to the 0 assertions, it passes.
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Ledger" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
---
You received this message because you are subscribed to the Google Groups
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.