Bug 452156

Summary: CSV importer : can not choose in which account to import
Product: [Applications] kmymoney Reporter: antoine <antoine>
Component: importerAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED NOT A BUG    
Severity: minor    
Priority: NOR    
Version: 5.1.2   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description antoine 2022-04-01 18:47:02 UTC
SUMMARY

I can not import a csv file correctly using the csv importer.
 * It does not ask me in which account to import 
 * At the end of the csv importer wizard, my data are in the wrong account 

STEPS TO REPRODUCE
1. start KMM, create an account named "Balance", File > Import > CSV
2. check Banking and add a profile, select a csv file
3. Follow the next step, at the last step (5.Format), click on "Import CSV)

OBSERVED RESULT

KMM does not ask me in which account these data should be imported
Imported data can be found in an account (no idea on how it has been chosen)

EXPECTED RESULT

I should be able to choose where the data should go at the end or begin of the wizard

SOFTWARE/OS VERSIONS

antoine@talos:~> zypper info kmymoney
Informations sur paquet kmymoney :
----------------------------------
Dépôt                     : openSUSE-Tumbleweed-Oss
Nom                       : kmymoney
Version                   : 5.1.2-3.5
Architecture              : x86_64
Fabricant                 : openSUSE
Taille une fois installé  : 21,8 MiB
Installé                  : Oui
État                      : à jour
Paquet source             : kmymoney-5.1.2-3.5.src
Upstream URL              : https://www.kmymoney.org/
Résumé                    : A Personal Finance Manager by KDE
Description               : 
    KMyMoney is a Personal Finance Manager by KDE. It operates
    similar to Quicken, supports various account types, categorization
    of expenses, multiple currencies, online banking support via QIF,
    OFX and HBCI, budgeting and a rich set of reports.

antoine@talos:~> lsb_release -a
LSB Version:	n/a
Distributor ID:	openSUSE
Description:	openSUSE Tumbleweed
Release:	20220317
Codename:	n/a
antoine@talos:~> 


ADDITIONAL INFORMATION
I think I was not lucking today, one of my account is named "Balance" and it took me a while before understanding this issue
Comment 1 Jack 2022-04-01 21:54:11 UTC
If you change the name of that account from Balance to Account (or anything else) do you still have the problem?  For me, when I hit "Import CSV" the next page of the wizard shows which account is being used, and as it doesn't know, it asks me to specify the account.  I even created a checking account named "Balance" and on csv import, it still asked me which account to use.
Comment 2 Thomas Baumgart 2022-04-02 07:45:46 UTC
Looking at https://invent.kde.org/office/kmymoney/-/blob/master/kmymoney/plugins/csv/import/core/csvimportercore.cpp#L708 the CSV importer scans the lines of the statement marked as headers to find a matching account name or account number. If exactly one match is found, the CSV importer assigns it to the statement (see https://invent.kde.org/office/kmymoney/-/blob/master/kmymoney/plugins/csv/import/core/csvimportercore.cpp#L829). That in fact bypasses the question for the account in the general statement importer. So it all depends on your data and account names/numbers.

If you never want the CSV importer to scan for a matching account, turn off the CSV importer autdetection option "Account in bank statement" in the plugin settings.
Comment 3 antoine 2022-04-02 09:53:00 UTC
(In reply to Jack from comment #1)
> If you change the name of that account from Balance to Account (or anything
> else) do you still have the problem?  

changing the name of that account solved this issue


(In reply to Thomas Baumgart from comment #2)
> If you never want the CSV importer to scan for a matching account, turn off
> the CSV importer autdetection option "Account in bank statement" in the
> plugin settings.

thank you for the tip