Bug 401831 - Unable to delete an insitution
Summary: Unable to delete an insitution
Status: RESOLVED WORKSFORME
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: 5.0.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-06 17:17 UTC by nigel
Modified: 2019-01-19 11:05 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nigel 2018-12-06 17:17:03 UTC
SUMMARY


STEPS TO REPRODUCE
1. Create a new institution
2. create a new institution with the same name
3. Try to delete the institutions

OBSERVED RESULT
Unless you assign an account the Institutions window does not show either institution.
Add a dummy account and the institution is now displayed
You cannot delete the institution because it has an attached account
Delete the account and the institution is no longer displayed so you cannot delete it

EXPECTED RESULT
An institution will always be displayed in the institutions window regardless of it having any accounts.
Now you could select the institution for deletion 

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

ADDITIONAL INFORMATION
Comment 1 Jack 2018-12-06 19:34:09 UTC
I think I see the problem.  However, not only do institutions with no assigned accounts show up, neither to institutions where all assigned accounts are closed.

If you go to Settings/Configure KMyMoney and uncheck "Do not show closed accounts" then these institutions DO show up in the Institutions View.  At least that is a workaround that will let you delete those Institutions.

While I can see some logic in including display of institutions in the logic for displaying accounts, it is certainly not obvious.  I can think of three options (in the order of my preference):
1) include a note on that view (if display of closed accounts is disabled) about changing that setting to view institutions with no accounts or with only closed accounts
2) always display all institutions in the institutions view
3) add a separate "do not show institutions with no assigned or only closed accounts" setting

The second might be best and simplest to implement, if I'm right that the institutions view is the only place where this matters.  However, it also means that the closed accounts would also need to be shown there.
Comment 2 Thomas Baumgart 2018-12-06 22:00:18 UTC
The source code contains the following comment:

---8<--- accountsproxymodel.cpp:230
If this is an institution that has no children show it only if hide unused institutions (hide closed accounts for now) is not checked.
---8<---

So the software works as designed. I suggest to go with option 2) as suggested by Jack for now (5.0.3) and add 1) to a future version (5.1+). Opinions?
Comment 3 nigel 2018-12-07 11:21:17 UTC
Thanks for a speedy response.
Workaround is acceptable