After extracting statement data using my custom importers I want 
automatically add pad directives for opened accounts that need them. I have 
got it working, but it's quite convoluted and I was wondering if I'm 
thinking about this problem in the wrong way.

I have written a plugin which injects pad directives for all opened 
accounts, so (as per 
https://docs.google.com/document/d/1QftxNvQPdH-MikMBHupftU6F4IsNZP5FlFh1LCbVgk8)
 
I use loader.load_file to run the plugin.

However, since the built-in pad plugin (beancount/ops/pad.py, maybe it has 
another name) runs before my pad plugin, I need to use loader.load_file a 
second time so that the padded transactions are actually added.

Since some pad directives can be unused, to avoid errors I use the output 
of the second call to loader.load_file to filter out pad directives that 
are not followed by a padded transaction.

A further issue is that when I use bean-check I get errors since the padded 
transactions have already been added (and no further transactions need to 
be added) -- maybe beancount/ops/pad.py should detect when padded 
transactions have already been added and not error in this case? To avoid 
this I remove all pad directives (instead of just the unused ones) after 
the second call to loader.load_file.

The result of this process is a beancount file that is verified by 
bean-check, but it feels like a lot of steps for what I would hope could be 
accomplished with a single pass.

Apologies for the long description (I hope it's clear enough), but is there 
a better way of doing what I am trying to do?

Thanks,
Luke



-- 
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/a1f4787a-9bad-44d9-88d0-187d9415009en%40googlegroups.com.

Reply via email to