Bug 502461 - Merge categories and delete old
Summary: Merge categories and delete old
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: bugtracker (show other bugs)
Version: git (master)
Platform: Other Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-04-05 19:14 UTC by bnbunch
Modified: 2025-04-07 07:51 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 5.2
Sentry Crash Report:


Attachments
Cant delete category unused (8.83 KB, image/png)
2025-04-05 19:14 UTC, bnbunch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bnbunch 2025-04-05 19:14:16 UTC
Created attachment 180034 [details]
Cant delete category unused

Have 2 categories I would like to merge Auto:Fuel and Auto:Gas .When trying to merge I get error
Unable to remove account with active splits.
 There are no splits. Just single line transaction. I was able to change category through ledger. But category still shows trnasaction to that category yet transactions show Auto:fuel as category

Cant add more than one attachment so you cane see where Auto:gas was removed , but still cant delete
Comment 1 bnbunch 2025-04-05 19:24:42 UTC
Found an old build. not Developer-Git
Version 3218 Was able to delete category and merge with no error. Please fix this for developer versions
Comment 2 Jack 2025-04-05 23:59:36 UTC
First, as a matter of terminology, all transactions have splits (most commonly two of them.)  One is for the account the money is moving into or out of, the other is the category.  Internally, KMyMoney treats Categories as a special type of Account.
Your description says you already changed the Category in one transaction from Gas to Fuel.  Did you look at the Category View to see if some other transaction still has Gas as the Category?
When you successfully deleted the Category using a 5.1 version, did it prompt you for another Category to assign the transactions to?  KMyMOney does not have an explicit option to merge categories, just to delete one, and if any transactions refer to that category, it prompts the user for a different category to assign transactions which point to the one you are deleting.  I'm fairly sure that has not changed between 5.1.3 and master. 
Please us a backup copy of your data to try again with the Developer version, to confirm the problem is repeatable.  If it is, we can then see if the problem remains if you create an anonymized version of the data, so the developers can confirm the problem.
Thanks.
Comment 3 Thomas Baumgart 2025-04-06 07:21:15 UTC
Problem duplicated. The process did not change. Fix pending.
Comment 4 Thomas Baumgart 2025-04-07 07:51:26 UTC
Git commit b5b94e814da3493a2d151f759cecbbdbdc226a38 by Thomas Baumgart.
Committed on 07/04/2025 at 07:50.
Pushed by tbaumgart into branch 'master'.

Clear object local reference cache when needed

Each object maintains a cache which other objects are referenced.
When replacing object ids this cache was not updated. This change
clears the cache in those cases which causes it to be rebuild upon
next usage.
FIXED-IN: 5.2

M  +7    -1    kmymoney/mymoney/mymoneyschedule.cpp
M  +3    -0    kmymoney/mymoney/mymoneysplit.cpp
M  +4    -0    kmymoney/mymoney/mymoneytransaction.cpp

https://invent.kde.org/office/kmymoney/-/commit/b5b94e814da3493a2d151f759cecbbdbdc226a38