Bug 430554 - Account closure
Summary: Account closure
Status: RESOLVED WORKSFORME
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: 5.0.1
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-18 20:58 UTC by Nick
Modified: 2021-01-11 01:50 UTC (History)
3 users (show)

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


Attachments
anonymised file with investment account that will not close (1.06 MB, application/x-zip-compressed)
2021-01-07 04:11 UTC, jlboz
Details
screenshot of error message (39.59 KB, image/jpeg)
2021-01-08 06:23 UTC, jlboz
Details
Screencast showing account closing (924.12 KB, video/x-matroska)
2021-01-09 06:54 UTC, Thomas Baumgart
Details
screen shot of left hand page column - missing icon for 'category' (60.77 KB, image/jpeg)
2021-01-09 09:43 UTC, jlboz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nick 2020-12-18 20:58:00 UTC
SUMMARY
Menu option to Close Account is always disabled

STEPS TO REPRODUCE
1. click on account
2. right click or select from menu to Close account
3. option disabled

OBSERVED RESULT
unable to select

EXPECTED RESULT
able to select action and account will be closed

SOFTWARE/OS VERSIONS
Windows: 10

ADDITIONAL INFORMATION
Comment 1 Jack 2020-12-18 21:00:39 UTC
An account can only be closed if there are no references to it.  Are you sure you don't have any scheduled transactions for that account?
Comment 2 Nick 2020-12-20 21:25:17 UTC
Thanks Jack,

yes, that was the case.  Managed to close it now.

I also have an investment account that will not close. It has no 
references, and its balance is zero (which I also noticed seemed to be a 
cause elsewhere).

Any suggestion for that ?

cheers

Nick

On 18/12/2020 09:00 pm, Jack wrote:
> https://bugs.kde.org/show_bug.cgi?id=430554
>
> Jack <ostroffjh@users.sourceforge.net> changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>           Resolution|---                         |WAITINGFORINFO
>               Status|REPORTED                    |NEEDSINFO
>
> --- Comment #1 from Jack <ostroffjh@users.sourceforge.net> ---
> An account can only be closed if there are no references to it.  Are you sure
> you don't have any scheduled transactions for that account?
>
Comment 3 Jack 2020-12-20 22:11:56 UTC
A balance isn't likely to be zero if there are any transactions in it.  For an investment account, are there any equities/securities in it?  Those have to be deleted first.  Easiest way to check is to open the ledger for the investment account and then click the Investments View Icon on the left.
Comment 4 Brendan 2020-12-21 00:23:50 UTC
I don't think you have to delete the equities, I think you just have
to close them.

----
Brendan Coupe

On Sun, Dec 20, 2020 at 3:12 PM Jack <bugzilla_noreply@kde.org> wrote:
>
> https://bugs.kde.org/show_bug.cgi?id=430554
>
> --- Comment #3 from Jack <ostroffjh@users.sourceforge.net> ---
> A balance isn't likely to be zero if there are any transactions in it.  For an
> investment account, are there any equities/securities in it?  Those have to be
> deleted first.  Easiest way to check is to open the ledger for the investment
> account and then click the Investments View Icon on the left.
>
> --
> You are receiving this mail because:
> You are the assignee for the bug.
Comment 5 Jack 2020-12-21 00:48:11 UTC
Brendan is correct - you probably have to delete them to delete the account, but only close them to close the account.  There's been a recent discussion about deleting accounts, which is why I was thinking in that direction.

(When replying to a bug by email, please remember that your ENTIRE email becomes your comment, so there is generally no reason to include any of the previous text.)
Comment 6 Dawid Wróbel 2020-12-21 01:00:32 UTC
Frankly speaking, from the UX perspective, we should never grey out/disable the "Close" or "Delete" account options. Instead, given that we already detect any lingering, recursive dependencies, we should explicitly ask for user's confirmation and simply Close/Delete them as well. 

This issue has been raised many times before. I can attest to it myself that it is extremely frustrating, as I have struggled with this when I first started to use KMM. 

I am marking it as confirmed and will try to get this fixed sometime soon.
Comment 7 Jack 2020-12-21 01:08:40 UTC
First, what I definitely agree with is providing adequate information to the user as to why something can't currently be done.  

I'm not really sure I agree with simply doing a cascade close/delete, although I'm less against it with closure.  Deletion is not reversible (yes, you should have a recent backup) and I'm afraid there will be people who just click "OK" without reading carefully, and then realize they didn't mean to actually delete all those other things, along with the account.
Comment 8 Dawid Wróbel 2020-12-21 01:12:20 UTC
I agree. The way I imagined this would work is that we would explicitly *list* all the elements that would be deleted, thus actually showcasing the gravity of the action, as opposed to just asking a vague question.
Comment 9 Brendan 2020-12-21 01:38:24 UTC
Sorry about that. I was in a hurry to answer since I just went through this and wanted Nick to know deleting equities was not required.

I completely agree with cascading equity closures as part of closing an account. This can be annoying if you have a bunch of equities in an old account that you close, which I did recently. Plus I don't do it often so I forget about this requirement.

I agree with Jack and would be very careful about doing this when deleting accounts. Not only is it final, it's also likely to affect other account balances, which may not be obvious to the user until it's too late.

Closing accounts seems to be fairly common, I have a lot more closed accounts than open accounts in my 15 year old KMM file.

The only time I have ever deleted an account was when I created the wrong type of account or did something else wrong. It's either barely used or I move the transactions to a properly created account first.

Given the recent discussion about deleting accounts that Jack was helping a user with, I think a cascading delete could do a lot more harm than good. I think he would have deleted the account and then found out what that means the hard way. Maybe a setting to enable both options is a good compromise.
Comment 10 Jack 2020-12-21 03:02:03 UTC
I'm not against deleting other accounts to delete the one you want to delete.  What takes much more care is if it also requires deleting transactions.  In any case, the first step is to be able to list ALL entities (accounts, transactions, equities, ....) that would need deleting.  If we can do that, then at least a user will not be frustrated not knowing why an acccount can not be closed/deleted.  We can further discuss whether or not to provide the cascading close/delete after that.
Comment 11 Nick 2020-12-21 21:52:33 UTC
Thanks again for the quick reply Jack (and Dawid et al),

 From what I've seen people wouldn't often want to fully delete an 
account once it has been used a while, as that would get rid of a lot of 
things like transfers to other accounts, sending them out of balance.

Closing accounts is the safer option as it will retain the history.  Its 
a great idea to report the consequences of both actions though if that 
can be done.  Cascading the action would also be terrific.

Great work you are doing by the way.  (I didn't actually know the app 
was still being maintained).

I'm going to raise another query btw, regarding the version numbers, as 
I can't seem to get the highest one installed.

keep safe and have a good Christmas.

Nick

On 21/12/2020 03:02 am, Jack wrote:
> https://bugs.kde.org/show_bug.cgi?id=430554
>
> --- Comment #10 from Jack <ostroffjh@users.sourceforge.net> ---
> I'm not against deleting other accounts to delete the one you want to delete.
> What takes much more care is if it also requires deleting transactions.  In any
> case, the first step is to be able to list ALL entities (accounts,
> transactions, equities, ....) that would need deleting.  If we can do that,
> then at least a user will not be frustrated not knowing why an acccount can not
> be closed/deleted.  We can further discuss whether or not to provide the
> cascading close/delete after that.
>
Comment 12 jlboz 2021-01-07 02:33:13 UTC
I have the same problem as others have already reported. Using v. 5.01 on a PC with Win10. I want to close an investment account. The associated brokerage account was closed with no difficulty when its balance was zero. The investment account balance also *appears* to be zero and there are no scheduled transactions, but still the option to close the account is not available. A fix would be much appreciated. 

If it is too difficult to stop rounding errors accumulating in an investment account over time, is it possible to create a workaround that arbitrarily adjusts the balance to zero when the balance is trivial (e.g. <0.01) and the user wants to close the account?
Comment 13 Jack 2021-01-07 03:15:06 UTC
jiboz:  are you certain all the equities in the investment account are all closed.  Note that the displayed balance of an investment account is the value of the currently held equities.  Again, those equities need not only to have zero value, but they need to be closed.
The discussion about whether the "close" menu item should not be disabled and lead to a cascading closing of other accounts and equities will continue separate from this specific bug.
Comment 14 jlboz 2021-01-07 03:28:14 UTC
(In reply to Jack from comment #13)
> jiboz:  are you certain all the equities in the investment account are all
> closed.  Note that the displayed balance of an investment account is the
> value of the currently held equities.  Again, those equities need not only
> to have zero value, but they need to be closed.
> The discussion about whether the "close" menu item should not be disabled
> and lead to a cascading closing of other accounts and equities will continue
> separate from this specific bug.

When I go to the page for Investments > Equities > [relevant account] there is an entirely blank page. There are no equities present for me to close.

On the page for Investments > Securities there are various funds which have all been sold so my current holdings of each one is zero.

If I look at the report "Investment Holdings by Account" for a period up to today it shows two securities with number of shares held at zero, a price per share and an amount of zero (presumably the product zero * price). 

Is there some way to close equities I have missed?
Comment 15 Jack 2021-01-07 03:43:25 UTC
Are you sure those two securities are closed?  They may already be closed if they do not show up on the Equities tab of the Investments View.  You can View/Show all accounts (Ctl-Shit-A).  If they are closed, they will show with a line through them.  If they ARE closed,  then we have to find another reason you can't close the investment account.  At this point, I would ask if you can save your data file as an anonymized file (see https://docs.kde.org/trunk5/en/extragear-office/kmymoney/details.formats.anonymous.html).  If "Close" is still unavailable in the anonymized version, you can post it to the bug.
Comment 16 jlboz 2021-01-07 04:11:58 UTC
Created attachment 134631 [details]
anonymised file with investment account that will not close

attachment as requested by Jack 2021-01-07 03:43:25 UTC in comment 15
Comment 17 jlboz 2021-01-07 04:21:31 UTC
(In reply to Jack from comment #15)
> Are you sure those two securities are closed?  They may already be closed if
> they do not show up on the Equities tab of the Investments View.  You can
> View/Show all accounts (Ctl-Shit-A).  If they are closed, they will show
> with a line through them.  

I tried View/Show all accounts. This made no difference with investment accounts because they are all open. Other types of account that are closed showed up with a line through as expected, including the closed brokerage account associated with the investment account I want to close. There are still no equities on the Investment view in relation to any investment account so there is nothing there I can close. I have attached an anonymised file, see previous reply.
Comment 18 Thomas Baumgart 2021-01-07 09:21:50 UTC
(In reply to jlboz from comment #14)

> Is there some way to close equities I have missed?

Actually, what you need to close the accounts, where the equities are managed. They are not directly visible in the account view, but there's an option to turn them on. "Show equity accounts" which is documented in the manual at https://docs.kde.org/stable5/en/extragear-office/kmymoney/details.settings.html#details.settings.general.filter Try to mark this, then goto the accounts view and see if you can close the equity accounts which should now be shown as sub-accounts of your investment account. Once they are closed, you should be able to close the investment account too.
Comment 19 jlboz 2021-01-07 10:20:05 UTC
(In reply to Thomas Baumgart from comment #18)
> (In reply to jlboz from comment #14)
> 
> > Is there some way to close equities I have missed?
> 
> Actually, what you need to close the accounts, where the equities are
> managed. They are not directly visible in the account view, but there's an
> option to turn them on. "Show equity accounts" which is documented in the
> manual at
> https://docs.kde.org/stable5/en/extragear-office/kmymoney/details.settings.
> html#details.settings.general.filter Try to mark this, then goto the
> accounts view and see if you can close the equity accounts which should now
> be shown as sub-accounts of your investment account. Once they are closed,
> you should be able to close the investment account too.

ok, I made Equity accounts visible in the accounts view. Equity has two subaccounts only, both "Opening Balances", each for a different currency. One entry in one of these accounts represents the opening balance of the brokerage account for the investment account that will not close. However, that brokerage account can be closed. Both the "Opening Balance" accounts have non-zero balances and cannot be closed. This does not seem to do anything to help close the investment account.

Incidentally, I have discovered that if I go directly to the Investments view as soon as I open the .kmy file there is one entry under Equity. This entry has a name that links it to the relevant investment account but there is no symbol, value, quantity or price. If I right click on this equiity the pop-up menu items are all greyed out except for "New Investment" and "Update Stock and Currency prices...". So I cannot close the equity because that option is not available. If I double click on the equity the investment detail wizard opens. I cannot find any option in the wizard that helps fix the problem. If I select an account at the top of the Equities tab this equity vanishes and can only be restored by closing and reopening the file.
Comment 20 Thomas Baumgart 2021-01-07 13:40:27 UTC
You're looking in the wrong spot:

jlboz: Equity has two subaccounts only, both "Opening Balances"
me: you can close the equity accounts which should now be shown as sub-accounts of your investment account.

With 'your investment account' I meant the one you try to close.

I was not talking about the Opening Balances area which has nothing to do with the problem of closing the account. Sorry, if this was not clear enough in the first round.
Comment 21 jlboz 2021-01-08 03:57:20 UTC
(In reply to Thomas Baumgart from comment #20)
> You're looking in the wrong spot:
> 
> jlboz: Equity has two subaccounts only, both "Opening Balances"
> me: you can close the equity accounts which should now be shown as
> sub-accounts of your investment account.
> 
> With 'your investment account' I meant the one you try to close.
> 
> I was not talking about the Opening Balances area which has nothing to do
> with the problem of closing the account. Sorry, if this was not clear enough
> in the first round.

ok. But as I said in comment 19 second para., there is nothing I can close under the Investment view either. There is an equity with a name but no details, it cannot be closed, and it vanishes when I click on the relevant account at the top of the investment page. It only reappears when I close and reopen the file.
Comment 22 jlboz 2021-01-08 06:08:18 UTC
(In reply to Thomas Baumgart from comment #20)

Now I've found the relevant equities in the Accounts view using the general setting to show equity accounts. In that view there are two open equity subaccounts under the investment account I want to close. Both of these equity accounts have zero value and have the option to be closed. Sadly, this does not help. When I choose "close" for either of them the program crashes. When I open it again, the equity accounts are still there. If I try to edit the account, and regardless of whether I make any actual changes, as soon as I close the investment detail wizard the program crashes with no change saved.

One step forward, one step back.
Comment 23 jlboz 2021-01-08 06:20:50 UTC
(In reply to Thomas Baumgart from comment #20)

I don't know if this has any relevance, but I tried editing the single equity that appears on the Investment view page (see comment 19 second para.) when I closed the investment detail wizard and error message appeared, see screenshot attached.
Comment 24 jlboz 2021-01-08 06:23:11 UTC
Created attachment 134652 [details]
screenshot of error message

see comment 23 for context. Error message after trying to save edit on Investment view page.
Comment 25 Jack 2021-01-08 21:43:32 UTC
I'm updating the header info to 5.0.1 based on Comment #12, and would request that you try a more recent version from https://binary-factory.kde.org/job/KMyMoney_Nightly_win64/ or https://binary-factory.kde.org/job/KMyMoney_Release_win64/ .  I still need to check the anonymized file per Comment #16.
Comment 26 Jack 2021-01-09 00:08:21 UTC
I found two investment accounts A000353 and A000384.  The first had two equities, A000354 and A000355, A000354 could easily be closed on the Equities tab of the Investment View (selected after displaying A000353 in the ledger.) A000384 had no transactions and could easily be closed without doing anything else.

Let us know what happens when you try using the recent appimage.
Comment 27 jlboz 2021-01-09 02:21:00 UTC
Jack, thanks for input. As suggested I updated to KMM version 5.1-65ab93d98. It  made no difference. It still behaves exactly as described in comment 22. Although you found you could close an equity in the Equity tab of the investment view, I cannot. After opening the Accounts view and the correct ledger I opened the Investment view. With the right account selected there were no equities displayed. The whole window was empty. The equities showed as subaccounts in the Accounts view but there was nothing in the investment view. Any attempt in the Accounts view to close either of them or to edit them, even opening and closing the wizard without making any changes, simply crashes the program. I have tested this multiple times.

Incidentally, in this version of KMM the left hand column of icons and labels for the different views - Home, Institutions etc. - has no icon for Categories, just a label. Does not matter, but looks odd when the rest all have icons.
Comment 28 Thomas Baumgart 2021-01-09 06:54:01 UTC
Created attachment 134673 [details]
Screencast showing account closing

I tried to duplicate the problem but must be missing something. To explain what I did, I attached a screen video of the session on the anon file provided.
Comment 29 jlboz 2021-01-09 08:29:46 UTC
Thomas, thanks for the screen video. That removes any doubt that I have (after some initial confusion) followed the required steps. I have repeated the steps in your video exactly just to make sure. 

When you close one of the stock accounts that is a subaccount of the investment account you see a pop-up information window saying the account is closed, then you continue. 

When I close the equivalent account the program crashes after a second or so, and I am back where I started.
Comment 30 jlboz 2021-01-09 09:07:12 UTC
I have tried the same steps with the anonymised file, downloaded from here. It behaved exactly as the file it is based on, that is, it crashed when I tried to close a stock subaccount. However, there is a difference. The video you posted shows investment account A000353 with six closed subaccounts and four open subaccounts: A000354, 355, 357 and 363. When I open the anonymised file in the same view the only open subaccounts are  A000354 & 355. All the other eight are closed. I wondered if you had opened two closed subaccounts before making the screen video, but when I tried to open 357 the program crashed. I tried one more time to close the stock subaccount in the anonymous file and this time the program froze for a few seconds and then crashed, instead of crashing immediately.
Comment 31 jlboz 2021-01-09 09:43:28 UTC
Created attachment 134675 [details]
screen shot of left hand page column - missing icon for 'category'

see comment 27 second para.
Comment 32 Thomas Baumgart 2021-01-09 14:54:13 UTC
One major difference: you do it on Windows, I do it on Linux. It may not be the cause, but it is something.

I tried it on a Windows machine with the latest stable version found on https://binary-factory.kde.org/job/KMyMoney_Release_win64/ (#888). Using it on the anon file, I am unable to duplicate the problem and don't see any crashes.
Comment 33 jlboz 2021-01-10 01:57:40 UTC
I installed release #888 but again no difference. Then I installed #888 on an old Win10 PC that normally I only use for data backups and copied the anon file and my working file there. This worked flawlessly after the initial set up. The equity and investment accounts closed as expected in both files.

Therefore I suspect the problem is some issue or corruption in the program files kept on my main PC: those files which remain when updating the release version. Unless you have a better suggestion I intend to search out and delete every trace of KMM on my main PC except for my data files, then begin again with a clean install. Any guidance on where to find every relevant file and folder gratefully received.
Comment 34 Thomas Baumgart 2021-01-10 17:09:28 UTC
Usually, the standard uninstall procedure does the job.
Comment 35 jlboz 2021-01-11 01:20:00 UTC
I uninstalled KMM on my main PC, as I have several times before. Then in Program Files I deleted two folders, MMyMoney and kmymoney5. In my User\.config folder I deleted two more files and a folder, under User\aqbanking\settings\apps I deleted file kmymoney.conf and lastly in User\.local\share I deleted folder kxmlgui5.

I restarted the PC and installed release #888 again. It launched with my current working file and not as a new user, so I failed to achieve a clean install. However I loaded the anon file and my old working file. In both I closed the stock and investment accounts with no difficulty. 

So far as I can tell the issue is resolved. The exact cause is not clear. Incidentally, there is still no icon for  categories in the left-hand column, same as shown in attachment 134675 [details].
Comment 36 Jack 2021-01-11 01:26:04 UTC
I'll close this one, since you are working again.  I'm not sure whether the missing icon issue is known already or not, but it would be a separate bug, probably related to the way the windows packages are created.

The fact that it remembers your data file (it has no concept of user) is because that is stored in a config file somewhere in under your home directory.  That allows you to upgrade and completely replace all program related files, without having to completely redo any configuration settings you changed.
Comment 37 jlboz 2021-01-11 01:31:57 UTC
ok. Jack, my thanks to both you and Thomas for all the support and help. I really appreciate it.
Comment 38 Jack 2021-01-11 01:50:33 UTC
WAITINGFORINFO is only used when we need more information in order to proceed.  WORKSFORME is pretty much like it sounds.  I don't want to call it NOTABUG, since we don't really know the exact reason, but we can't use FIXED, because we didn't fix anything in the code.