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

Using this example category structure:

EXPENSE
a:b:c

  • 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.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? 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