Asserting closing balance?

84 views
Skip to first unread message

James Cook

unread,
Nov 14, 2020, 12:30:55 PM11/14/20
to bean...@googlegroups.com
This is a minor issue, easy to work around, but I'm wondering if I'm
missing something.

How should I assert that an account's balance was 0 after it closed?
I'd like to be able to write

2020-11-09 close Liabilities:Scotiabank:Visa
2020-11-10 balance Liabilities:Scotiabank:Visa 0 CAD

but beancount complains: "Invalid reference to inactive account
'Liabilities:Scotiabank:Visa'".

I can't change the balance date to 2020-11-09 because I have a
transaction on the closing date.

I have worked around it with

2020-11-10 close Liabilities:Scotiabank:Visa
note: "Actually closed 2020-11-09."
2020-11-10 balance Liabilities:Scotiabank:Visa 0 CAD

but that seems messy.

James

Martin Blais

unread,
Nov 14, 2020, 3:58:44 PM11/14/20
to Beancount
Workarounds is what I was going to suggest.
Maybe the code should be changed to allow for a balance directive the day after.
(Balance is defined at the start of day.)

Another idea would be to write a plugin that automatically checks that inventories are empty - for all currencies - on closing, everywhere, automatically.
That ought to exist and would be easy to write (and should be included in beancount/plugins by default if you ask me).



--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAHpmPOAXYX0UCTQhq%2B5VVzOXWnw-n97Vp7%3D2WZ8DoU36g43jcw%40mail.gmail.com.

Justus Pendleton

unread,
Nov 15, 2020, 8:35:58 PM11/15/20
to Beancount
On Sunday, November 15, 2020 at 12:30:55 AM UTC+7 James Cook wrote:
This is a minor issue, easy to work around, but I'm wondering if I'm
missing something.

There's an open issue for this and last year I implemented a variant of it

But while doing so I realized that the easy implementation originally suggested in the ticket had exactly the problem you're running into so I didn't spend much energy trying to get my PR merged.

I just use the workaround in the meantime.

Martin Blais

unread,
Nov 16, 2020, 9:57:25 PM11/16/20
to Beancount
FWIW, I've preserved your PR in the transition to GitHub as pr137_hoostus_balanceend, it's in the repository.



--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.

Martin Blais

unread,
Nov 17, 2020, 12:35:59 AM11/17/20
to Martin Blais, Beancount
Here, solved your problem by allowing Balance directives after closure:

Read commentary and patch for justification.


Justus Pendleton

unread,
Nov 18, 2020, 4:34:27 AM11/18/20
to Beancount
On Tuesday, November 17, 2020 at 12:35:59 PM UTC+7 bl...@furius.ca wrote:
Here, solved your problem by allowing Balance directives after closure:

Read commentary and patch for justification.

This seems like a good solution to the problem. I can't really think of any reason not to be able to assert a balance for a closed account. It also probably makes a "balance at end of day" statement more trouble than it is worth.

James Cook

unread,
Nov 20, 2020, 3:01:04 AM11/20/20
to bean...@googlegroups.com, Martin Blais
Thanks, Martin. It works for me.
> To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAK21%2BhN6fruvFLc-wdghduBXeK%2BRXoC%2BR9TUuTaUV8RRBmOZwQ%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages