Bug 456565 - Category autocomplete should focus on the parent, if child account also matches
Summary: Category autocomplete should focus on the parent, if child account also matches
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: ux-ui (show other bugs)
Version: git (master)
Platform: Other Other
: NOR wishlist
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-10 22:02 UTC by Dawid Wróbel
Modified: 2022-07-11 09:03 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dawid Wróbel 2022-07-10 22:02:43 UTC
SUMMARY
When more than one account in a branch matches the typed-in search term, the autocomplete should stop at the first matching parent account, not the leaf. The rationale here is that the child account is a more specific account of the generic parent, and as such, there can be many more such leafs under said parent. We should assume the generic account is likely to be chosen more frequently. In my example, I use that for denoting same categories of different currencies, but the parent account is always of my main currency, which indeed means I am more likely to assign a category to it, as I usually spend in that currency. 

Alternatively, a more sophisticated logic would preselect an account that matches the transaction's currency — and maybe even mark the other with an appropriate icon, to warn that currency conversion would be required. 

STEPS TO REPRODUCE
1. Create category hierarchy, where two accounts, a parent and a leaf, have the same name, but the leaf also bears and additional suffix 
2. In transaction editing dialog, type in the account name such that both are shown 

OBSERVED RESULT
The leaf is automatically selected, even though the parent account also matches.

EXPECTED RESULT
The parent account should be preselected. 


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

ADDITIONAL INFORMATION
Comment 1 Thomas Baumgart 2022-07-11 09:03:18 UTC
Git commit 4679a37421c45b17f6a5f87d8865fd8b6caa47d4 by Thomas Baumgart.
Committed on 11/07/2022 at 09:00.
Pushed by tbaumgart into branch 'master'.

Select first matching account item during search

When more than one account in a branch matches the typed-in search term,
the autocomplete stops at the first matching item which does not need to
be a leaf as in the original implementation.

M  +13   -6    kmymoney/widgets/kmymoneyaccountcombo.cpp

https://invent.kde.org/office/kmymoney/commit/4679a37421c45b17f6a5f87d8865fd8b6caa47d4