BUG: Account.getAccountByName() on Categories when using AccountType returns wrong Account

Stuart Beesley (Mr Toolbox)'s Avatar

Stuart Beesley (Mr Toolbox)

11 Jun, 2021 12:30 PM

Using this example category structure:


  • calling root.getAccountByName("a:b:c") correctly returns the account for a:b:c

  • calling root.getAccountByName("xx:yy:c") correctly returns None as it does not exist

  • But calling root.getAccountByName("xx:yy:c", Account.AccountType.EXPENSE) incorrectly returns the Account for "a:b:c" (note xx:yy:c does not exist). It seems to somehow just be looking for the last account name in the string, rather than matching all the prior accounts between the ::'s

I am unclear whether it matters which object you call .getAccountByName() on - i.e. does it matter.. My tests indicate not. This is an annoying problem. The only resolution is to call the function without the AccountType and then check the returned account's account type (but of course, doesn't help with duplicate account names.

  1. System closed this discussion on 10 Sep, 2021 12:40 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac