Bug 436177

Summary: Category Auto-Creation does not work as intended
Product: [Applications] kmymoney Reporter: Marcel Hoffmann <kdebugreport>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED NOT A BUG    
Severity: normal CC: me
Priority: NOR    
Version: 5.1.1   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Dialog after creating a new category from the ledger view
Selecting the correct parent
Actual parent is shown on the bottom of this screenshot

Description Marcel Hoffmann 2021-04-25 17:43:40 UTC
Created attachment 137908 [details]
Dialog after creating a new category from the ledger view

SUMMARY
Entering a new ledger entry allows to auto-create a new category if it does not exist. The dialog explains that the parent category will be Expense/Income, but can be changed in the next dialog. Selecting the correct parent category in the next dialog does not work as intended. Instead of adding the new category under the selected parent, it duplicates the whole category structure under the new parent entry.

STEPS TO REPRODUCE
1. Enter new ledger entry
2. Enter non-existing category, e.g. "Food:Groceries:Fruit"
3. Click "Yes" in next dialog
4. Change parent category, e.g. from "Expense" to "Expense:Food:Groceries"
5. Click "OK"

OBSERVED RESULT

New category structure is "Food:Groceries:Food:Groceries:Fruit"


EXPECTED RESULT

New category structure should be "Food:Groceries:Fruit"

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Marcel Hoffmann 2021-04-25 17:44:09 UTC
Created attachment 137909 [details]
Selecting the correct parent
Comment 2 Marcel Hoffmann 2021-04-25 17:44:31 UTC
Created attachment 137910 [details]
Actual parent is shown on the bottom of this screenshot
Comment 3 Thomas Baumgart 2021-04-26 06:06:24 UTC
The application works as intended. In case you provide a hierarchy (account names separated by colons) to be created, KMyMoney will do so under the parent account you select. Even if the names are identical to those in the parent, the whole path will be added to the selected parent. Select Expense as the parent and things are working as expected by you.

In case parts of the hierarchy exist already they will be used. Only missing parts will be created.
Comment 4 Dawid Wróbel 2021-04-26 16:18:48 UTC
I suppose that the new account together with its structure (e.g. "Food:Groceries:Food:Groceries:Fruit") could be hinted on the Hierarchy Tab to avoid confusion.
Comment 5 Marcel Hoffmann 2021-04-30 06:24:06 UTC
Thank you for looking into this. I agree that a hint in the dialog would help. My expectation was that the dialog asks where to place the new category and not where to place the whole category structure. The initial dialog made it look like "Fruit" would become a direct child of the "Expense" parent account and that action was required to put it in the right place.
Comment 6 Thomas Baumgart 2021-05-01 06:12:39 UTC
Git commit 4e782229d6122a9939bbd5fdafb0bd6560c37fb3 by Thomas Baumgart.
Committed on 01/05/2021 at 06:12.
Pushed by tbaumgart into branch 'master'.

Improve information about account position in hierarchy

M  +15   -3    kmymoney/dialogs/knewaccountdlg.cpp

https://invent.kde.org/office/kmymoney/commit/4e782229d6122a9939bbd5fdafb0bd6560c37fb3