Bug 422012

Summary: Incorrect account hierarchy if an account is marked as preferred
Product: [Applications] kmymoney Reporter: Robert Szczesiak <dev.rszczesiak>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal CC: me
Priority: NOR    
Version: git (master)   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed In: 5.1.0
Sentry Crash Report:
Attachments: Test file - hierarchy_test.kmy
Incorrect hierarchy tab
Incorrect account hierarchy after edit
Expected hierarchy tab after fix

Description Robert Szczesiak 2020-05-24 13:19:04 UTC
Created attachment 128744 [details]
Test file - hierarchy_test.kmy

SUMMARY
When an account is marked as preferred and the user edits it, the account is moved up in the hierarchy tree even though the user does not enter the Hierarchy tab to change anything. When the user opens the Hierarchy tab, there is Favorites category displayed but it should not.

STEPS TO REPRODUCE
1. Open the attached hierarchy_test.kmy file.
2. Go to the Accounts view and right-click "My Test Account 3" and select "Edit account..." option from the context menu.
3. On the Edit window do not change anything and simply click the OK button.

OBSERVED RESULT
My Test Account 3 is moved up in the hierarchy tree and becomes a direct sub-account of Asset. When the file is reopened without saving, one can see in the account edit window's Hierarchy tab that there is Favorites category displayed although it should not.

EXPECTED RESULT
The edited account should remain sub-account of My Test Account 2. Favorites category should not be present in the Hierarchy tab.

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.18.4
KDE Frameworks Version: 5.70.0
Qt Version: 5.14.2

ADDITIONAL INFORMATION
Please find attached screenshots presenting the issue.
Comment 1 Robert Szczesiak 2020-05-24 13:19:43 UTC
Created attachment 128745 [details]
Incorrect hierarchy tab
Comment 2 Robert Szczesiak 2020-05-24 13:20:08 UTC
Created attachment 128746 [details]
Incorrect account hierarchy after edit
Comment 3 Robert Szczesiak 2020-05-24 13:20:31 UTC
Created attachment 128747 [details]
Expected hierarchy tab after fix
Comment 4 Thomas Baumgart 2020-05-24 17:36:29 UTC
Git commit 5412d8e32c85485f047127fb2b0e2edfff53ddb4 by Thomas Baumgart, on behalf of Robert Szczesiak.
Committed on 24/05/2020 at 17:36.
Pushed by tbaumgart into branch 'master'.

Fix incorrect account hierarchy if the account is marked as preferred

When an account was marked as preferred and the user edited it, the
account was moved in the hierarchy tree even though the user did not
enter the Hierarchy tab to change anything. When the user opened the
Hierarchy tab, there was Favorites category displayed but it should not.

This commit solves the issue so that a preferred account is not moved
when the user does not want it to. The Favorites catergory is now not
displayed in the Hierarchy tab.
Signed-off-by: Robert Szczesiak <dev.rszczesiak@gmail.com>

M  +6    -5    kmymoney/dialogs/hierarchyfilterproxymodel.cpp
M  +1    -1    kmymoney/dialogs/knewaccountdlg.ui

https://invent.kde.org/office/kmymoney/commit/5412d8e32c85485f047127fb2b0e2edfff53ddb4
Comment 5 Thomas Baumgart 2020-05-24 17:38:19 UTC
Git commit d65ae5a6dd8d7e4050a04e2dcea1fe63ffb66782 by Thomas Baumgart.
Committed on 24/05/2020 at 17:37.
Pushed by tbaumgart into branch '5.0'.

Fix incorrect account hierarchy if the account is marked as preferred

When an account was marked as preferred and the user edited it, the
account was moved in the hierarchy tree even though the user did not
enter the Hierarchy tab to change anything. When the user opened the
Hierarchy tab, there was Favorites category displayed but it should not.

This commit solves the issue so that a preferred account is not moved
when the user does not want it to. The Favorites catergory is now not
displayed in the Hierarchy tab.
FIXED-IN: 5.0.9

Signed-off-by: Robert Szczesiak <dev.rszczesiak@gmail.com>
(cherry picked from commit 5412d8e32c85485f047127fb2b0e2edfff53ddb4)

M  +6    -5    kmymoney/dialogs/hierarchyfilterproxymodel.cpp
M  +1    -1    kmymoney/dialogs/knewaccountdlg.ui

https://invent.kde.org/office/kmymoney/commit/d65ae5a6dd8d7e4050a04e2dcea1fe63ffb66782