It looks like when a transaction is a transfer (indicated by [Account Name] in the category field, it is handled properly and the account name is applied to the to_account field and the category is left None.
However, if this kind of transfer occurs in a split, it isn't handled the same way. In the Split, the account name is assigned to category and not to_account.
Here's an example transaction in the "Checking" account. It is a $10 transfer with $9 going to the "Savings" account as a transfer, and $1 going to a Cash category.
In Transaction.from_list, when parsing a split transaction, we apply the same logic as when parsing a non-split transaction. Look for the opening bracket "[". If found, set to_account instead of category. With that change, I now get:
print(qif.accounts["Checking"].transactions["Bank"][6].splits[0])
Split:
Amount: -9.00
To Account: Savings
Percent: 90.000000000
I have one more for you.
Problem
It looks like when a transaction is a transfer (indicated by
[Account Name]
in the category field, it is handled properly and the account name is applied to theto_account
field and the category is leftNone
.However, if this kind of transfer occurs in a split, it isn't handled the same way. In the
Split
, the account name is assigned tocategory
and notto_account
.Here's an example transaction in the "Checking" account. It is a $10 transfer with $9 going to the "Savings" account as a transfer, and $1 going to a Cash category.
Here's how that is currently parsed.
Suggested Solution
See https://github.com/isaacharrisholt/quiffen/compare/main...lcmcninch:quiffen:split_to_account for my suggested solution.
In
Transaction.from_list
, when parsing a split transaction, we apply the same logic as when parsing a non-split transaction. Look for the opening bracket"["
. If found, setto_account
instead ofcategory
. With that change, I now get:Thoughts? If you agree, I can submit a PR.