Zero-value automatic postings being pruned
(As previously discussed here: https://groups.google.com/g/beancount/c/ucfh1LdSSUU )
When a transaction entry has an automatic posting with zero value, the automatic posting is not emitted. This caused an issue for a plugin I am working on.
For example, consider the following entry:
2025-05-29 * "Pay Sample Bill" Liabilities:Foo 0.00 USD Expenses:Bar
A 0.00 USD posting for Liabilities:Foo appears in the journal, but a 0.00 USD posting for Expenses:Bar does not appear.
If I add an "or True" to the condition on this line, then both postings appear in the journal.
https://github.com/beancount/beancount/blob/eaeaa64532875f39e7cb7764c33ce4f9a4c78975/beancount/parser/booking_full.py#L930
As far as I can tell, the pruning happens here: https://github.com/beancount/beancount/blob/eaeaa64532875f39e7cb7764c33ce4f9a4c78975/beancount/parser/booking_full.py#L1003
Thank you!
This causes another bug as well: if the account name is invalid, then no error is reported.
The reason for the pruning... I forget, but there must have been a reason. One way to test it out would be to run "bean-query print" with and without a patch to remove the pruning and see how they differ. You'd have to do this on a realistic file to cehck it out.