Bug 390406

Summary: switching from Investments page to Ledgers always shows same stale closed account ledger
Product: [Applications] kmymoney Reporter: Dave Nelson <merlinux>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: minor CC: lukasz.wojnilowicz, mfcarpino
Priority: NOR    
Version: git (master)   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 5.0.1
Sentry Crash Report:

Description Dave Nelson 2018-02-13 21:09:39 UTC
Version 5.0.80-09ffa40a

Clicking on Ledgers after Investments displays stale ledger from a closed account.  This happens with all my investment accounts, and it's always the same stale ledger.

Reselecting the account in Ledger view gets around this, so no big deal.

Thanks.
Comment 1 Thomas Baumgart 2018-02-15 08:16:55 UTC
Version 5.0.80-09ffa40a is clearly of master and not the 5.0 branch.

Could it be, that the Preferred account flag is set for the closed account? What happens, if you turn that off?
Comment 2 Dave Nelson 2018-02-15 17:57:08 UTC
(In reply to Thomas Baumgart from comment #1)
> Version 5.0.80-09ffa40a is clearly of master and not the 5.0 branch.
> 
> Could it be, that the Preferred account flag is set for the closed account?
> What happens, if you turn that off?

I have trouble seeing the closed accounts. Show All Accounts has no effect on the account list.  Somehow I managed to see that it is NOT a preferred account, but I'm not sure what I right-clicked on, I can't get into Edit Account again for a closed account.  
None of my open accounts is a preferred account, so it's likely the closed ones are not either.
Comment 3 Dave Nelson 2018-02-21 21:49:16 UTC
more info on this problem:
1) on the Investments page the Select Account combo box shows the account being displayed
2) then click on Ledgers and the account name at the top has changed to a different account.

It looks like the account selection in Ledgers page is no longer synchronised when you switch accounts in the Investments page.

If after starting KMM, you first click on Investments, it seems that the selection of the Ledgers account is not initialised.  That's when I see the closed chequing account.
Comment 4 Michael Carpino 2018-02-21 22:38:43 UTC
I defined this problem Monday with this bug https://bugs.kde.org/show_bug.cgi?id=390741

I have no preferred accounts.  The only place you can see closed accounts after you check Show all accounts is at the Ledger page.  In previous versions, closed accounts were viewable on the home and account page.

The only workaround is to go to the ledger page and reopen the account and then edit the account.
Comment 5 Dave Nelson 2018-02-27 20:34:35 UTC
more info:

case 1:
start kmm, select Ledgers view, account selection combobox is blank, stale account is shown (in my case a closed chequing account). 

case 2:
start kmm, select Investments view, this is OK, first investment account is shown, select Ledgers view, same closed chequing account shown, account selection combobox is blank.

case3:
switch among accounts in Investments view, then select Ledgers view, and the previously shown account is still displayed.
in other words, Ledgers view is not synced when account is changed in Investments view.

once an account has been explicitly selected in Ledgers view, the stale account does not appear again, 
but the account shown is not the one selected in Investments view before switching to Ledgers.
Comment 6 wojnilowicz 2018-03-04 13:26:35 UTC
Git commit 757c7cbe64e0a82794677321f3ce6c1e795185c5 by Łukasz Wojniłowicz.
Committed on 04/03/2018 at 13:24.
Pushed by wojnilowicz into branch 'master'.

Remember last selected account in ledgers
FIXED-IN:5.0.1

M  +12   -9    kmymoney/views/kgloballedgerview.cpp
M  +1    -0    kmymoney/views/kgloballedgerview_p.h

https://commits.kde.org/kmymoney/757c7cbe64e0a82794677321f3ce6c1e795185c5
Comment 7 Thomas Baumgart 2018-03-04 15:04:38 UTC
Git commit aaaf1272a80366a8a5edac2d177a34de5967b44d by Thomas Baumgart.
Committed on 04/03/2018 at 15:00.
Pushed by tbaumgart into branch '5.0'.

Remember last selected account in ledgers

FIXED-IN: 5.0.1

(cherry picked from commit 757c7cbe64e0a82794677321f3ce6c1e795185c5)

M  +12   -9    kmymoney/views/kgloballedgerview.cpp
M  +1    -0    kmymoney/views/kgloballedgerview_p.h

https://commits.kde.org/kmymoney/aaaf1272a80366a8a5edac2d177a34de5967b44d
Comment 8 Dave Nelson 2018-03-05 03:12:13 UTC
Version 5.0.80-757c7cbe

there still seems to be a problem...

start kmm, click on Ledgers without selecting acct in home view, stale acct is still shown, combobox shows 'Asset', before the fix this was blank.

however, selecting Ledgers after Investments now syncs to the correct acct.

thanks.
Comment 9 Thomas Baumgart 2018-03-05 07:03:34 UTC
Does the problem get solved for you if you apply the changes of commit 15ca4f5fce44c552a?
Comment 10 wojnilowicz 2018-03-05 19:21:11 UTC
(In reply to David Nelson from comment #8)
> Version 5.0.80-757c7cbe
> 
> there still seems to be a problem...
> 
> start kmm, click on Ledgers without selecting acct in home view, stale acct
> is still shown, combobox shows 'Asset', before the fix this was blank.

It could be a bug or a wish to change default behaviour. I think that using preferred account, as Thomas suggested, should solve your issue.

> however, selecting Ledgers after Investments now syncs to the correct acct.
> 
> thanks.

No problem. Please don't aggregate issues in one bug, because it's harder to solve the bug. This bug was about synchronization between ledgers and investment views. Any other issue should be precisely reported as an another bug.
Comment 11 Dave Nelson 2018-03-05 19:30:29 UTC
i'm not comfortable yet with git branching, but i pulled branch 5.0 and confirmed that kgloballedgerview_p.h has your changes.

if you start kmm, click on Ledgers (without selecting an account in Home view) 
the account selection combobox is still showing 'Asset'.

the problem seems to be that Ledgers view does not default to an account
(before the user selects one) in the way Investments view does.
Comment 12 Jack 2018-03-05 21:06:20 UTC
Per comment 11, the issue of which account is shown in the ledger if no account has yet been selected is different from showing some account in the ledger, switching to another view, and switching back to the ledger and seeing a different account.  Since the fix for the first did not happen to address the second (because they really are separate issues) I've submitted this separately as bug 391453.