Optionally make commodity directive mandatory?

50 views
Skip to first unread message

Lover O'Bean

unread,
Dec 28, 2023, 5:16:32 PM12/28/23
to bean...@googlegroups.com
I am new to beancount, but would like the option of requiring that each commodity / currency be created with a commodity directive before being used, in the same way that accounts require an open directive before being used.

For example, if I declare AIRMILES.WN (IATA code) today but two years from now enter a transaction which accrues AIRMILES.SW (vernacular), I would like to get an error, just like if I referred to a nonexistent account.

Is this a good idea, or am I off-base?




Martin Michlmayr

unread,
Dec 28, 2023, 6:08:17 PM12/28/23
to bean...@googlegroups.com
There's a plugin for this: validate_commodity_directives

A plugin that verifies that all seen commodities have a Commodity directive.

* Lover O'Bean <lover...@gmail.com> [2023-12-28 17:16]:
> --
> 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/CABV0qx7m7iR8vYK%2BsgXjGx7UvV0uEsh1WaGE3hpL8eGc8Qiiqw%40mail.gmail.com.

--
Martin Michlmayr
https://www.cyrius.com/

Lover O'Bean

unread,
Dec 28, 2023, 8:11:56 PM12/28/23
to Beancount
Yes; while it doesn't address timing, it should be good enough for now:

(Also, while I was "in the neighborhood", I noticed another plugin that addresses another concern that I had.)

Thanks Martin!

Martin Blais

unread,
Dec 28, 2023, 8:14:02 PM12/28/23
to Beancount
Reply all
Reply to author
Forward
0 new messages