actual
actual copied to clipboard
[Bug]: Moving transactions between accounts can create transfers with unchangable categories
Verified issue does not already exist?
- [X] I have searched and found no existing issue
Is this related to GoCardless, Simplefin or another bank-sync provider?
- [ ] I have checked my server logs and could not see any errors there
- [ ] I will be attaching my server logs to this issue
- [ ] I will be attaching my client-side (browser) logs to this issue
- [ ] I understand that this issue will be automatically closed if insufficient information is provided
What happened?
Reproduction:
- Create transactions which are transfers to an off-budget account.
- Categorise them.
- Move the transactions back to an on-budget account (select them all then use dropdown menu to change account).
Manifestation:
- Look at the category you set in your budget, you'll see values in the spend column and clicking it will filter to those same transactions even though category is now transfer and can't be changed.
Fix:
- Category should be cleared when moving transfer transactions from an off-budget to an on-budget account.
- Data migration should be deployed to clear out categories on existing transfers effected by this.
What error did you receive?
No response
Where are you hosting Actual?
Docker
What browsers are you seeing the problem on?
Firefox
Operating System
Linux
I tried to recreate the issue. What am I doing wrong?
I was able to recreate it. It seems that since a category was set when that was allowed, that app can't tell that the category should not matter any more once the transaction is moved to a different account.
One option to fix this could be to add an extra check in what counts on budget to not accidentally include transfers. The visuals show that its a transfer, but the search for categories doesn't check that.
That would probably be simpler than a full on migration
I tried to recreate the issue. What am I doing wrong?
@shall0pass You need to make the transfer originally go to an off budget account, then change the account to an on budget one after the transaction is created
I tried to recreate the issue. What am I doing wrong?
@shall0pass You need to make the transfer originally go to an off budget account, then change the account to an on budget one after the transaction is created
Isn't that what I did? The House Asset is off-budget.
@shall0pass I changed the account via the all acounts page, not the original account holder page. It may be the case that there is already some logic to clean this up that isn't getting called when modifying the account instead of the payee like you did
I think that the place to fix the core issue lives in packages/loot-core/src/server/budget/base.ts in one of either/both the handleTransactionChange or createCategory functions.
The createCategory
function looks to be what determines the spent cell value and is a long sql query. This could be modified to remove on-budget transfers from the list.
The handTransactionChange
function could fix the issue of not unsetting the category, but that may require a db migration to fully fix.
Looks like if you do other changes to the broken transaction, like change the cleared status, or reconcile the account things fix themselves.
I don't know why doing a different modification would unset the category properly, but it didn't happen before.