Description
For accounts like 401k plans, until AVERAGE booking is implemented, we are advised to use NONE booking. My plan recently did a fund swap and after that transaction, despite the balance of the old account being 0 and being closed, it still shows on Fava's Balance Sheet display. I've attached a reduced booking-none-test.bean.txt file that demonstrates this.
I tracked the issue down to template_filter.should_show()
, which uses account.balance_children.is_empty()
to determine if there are any inventory still associated with the account. For accounts that use full booking, reductions will remove positions of an inventory and will cause the account to be empty when all are removed. But for NONE booked accounts, reductions are stored as negative positions, with the sum of the positions producing the net balance.
The issue thus appears to be in core.inventory.CounterInventory.is_empty()
, since it does:
def is_empty(self):
"""Check if the inventory is empty."""
return not bool(self)
As a quick hack, I changed the implementation to:
def is_empty(self):
"""Check if the inventory is empty."""
return not bool(self) or sum([a for _, a in self.items()]) == 0
The above is probably not the right fix since I'm not an expert, but it did resolve the issue for me.
Activity