Jul 24, 2022, 4:26:06 PM7/24/22
When I do a ledger.read_journal in python on a file with virtual postings,
has_flag(POST_VIRTUAL) returns False. I would expect it to return True.
Here's a bash run with the details:
$ ledger --version
Ledger 3.2.1-20200518, the command-line accounting tool
Copyright (c) 2003-2019, John Wiegley. All rights reserved.
This program is made available under the terms of the BSD Public License.
See LICENSE file included with the distribution for details and disclaimer.
$ python3 --version
$ cat journal.dat
2022-7-24 August 2022 Budget
$ cat virtual_posts.py
for xact in ledger.read_journal("journal.dat"):
for post in xact.posts():
is_virtual = post.xdata().has_flags(ledger.POST_VIRTUAL)
must_balance = post.xdata().has_flags(ledger.POST_MUST_BALANCE)
print("%r is virtual: %s, must balance: %s" % (post, is_virtual, must_balance))
$ python3 virtual_posts.py journal.dat
<ledger.Transaction object at 0x7f588b011040>
<ledger.Posting object at 0x7f588b0110a0> is virtual: False, must balance: False
<ledger.Posting object at 0x7f588b011100> is virtual: False, must balance: False
Can anyone spot any issues with what I'm doing? If not, should I file a
bug against ledger?