Hi,
I've been using padding to account for errors in my accounts and bank, for
example for transactions which I may have forgotten but are small enough
that I don't want to hunt for them. Usually, this goes along the lines of:
2023-12-04 pad Assets:Checking Equity:Adjustments
2023-12-05 balance Assets:Checking 1000 USD
whenever I want to check an account in beancount with my bank. I'm also
using plugins which manipulate the transactions. However, beancount loads
the padding plugin (ops.pad) before my custom plugins in PLUGINS_PRE(see
beancount/loader.py), which leads to padding the accounts with values
before manipulation by my plugin. Since the balance directive is in
PLUGINS_POST, this leads to an error. For an example, see the following
beancount file and plugin file:
; file: temp.beancount
option "operating_currency" "USD"
option "insert_pythonpath" "True"
plugin "plugin_temp"
2020-01-01 open Equity:Adjustments
2020-01-01 open Assets:Checking USD
2020-01-01 open Expenses:Groceries
2023-01-01 pad Assets:Checking Equity:Adjustments
2023-01-02 balance Assets:Checking 1000 USD
2023-02-01 * "Eggs"
Expenses:Groceries 100 USD
Assets:Checking
2023-03-01 pad Assets:Checking Equity:Adjustments
2023-03-02 balance Assets:Checking 700 USD
; file: plugin_temp.py in the same directory
from beancount.core import data
__plugins__ = ('plugin_temp',)
def plugin_temp(entries, unused_options_map):
new_entries = list(e for e in data.filter_txns(entries) if e.flag ==
'*')
return new_entries + entries, []
With bean-check, this gives the error
Balance failed for 'Assets:Checking': expected 700 USD != accumulated 600
USD (100 too little)
2023-03-02 balance Assets:Checking 700
USD
Is there a particular reason ops.pad is in PLUGINS_PRE and not in
PLUGINS_POST? Putting ops.pad in PLUGINS_POST seems to solve this issue.
Also, it seems that issue
https://groups.google.com/g/beancount/c/bMo9A6lM9Z4/m/egj3rGBMBAAJ is still
unsolved. This also affects my above workflow, but I'm presently easily
sidestepping it by not using padding on an account where I do balance
checks.
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/beancount/2746b201-9323-46b0-b97f-432c0c6d8f81n%40googlegroups.com.