Bug 409098

Summary: Gnucash importer ignores the accounts currencies
Product: [Applications] kmymoney Reporter: Dawid Wróbel <me>
Component: importerAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: git (master)   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.0.5
Sentry Crash Report:
Attachments: Obfuscated Gnucash xml

Description Dawid Wróbel 2019-06-24 00:43:52 UTC
Created attachment 121104 [details]
Obfuscated Gnucash xml

SUMMARY
I attempted to migrate my finances to kmymoney. However, while the transactions and accounts are migrated properly, the currencies of each account are not. 

The gnucash data attached is obfuscated. It contains ~20k transactions. The import itself is reasonably quick, but after choosing the base currency, the MyMoneyStorageMgr::transactionCount() is painfully slow.

STEPS TO REPRODUCE
1. Import GnuCash file
2. You can skip the base currency selection to avoid the slow tranasactionCount() 

OBSERVED RESULT
If you choose the base currency at import time, all accounts will end up having the same base currency set. If you skip the base currency selection, the accounts will display the transactions and summaries all with an unspecified denomination. Right-clicking on each of them will reveal the currency box greyed-out and set to HRK, but HRK does not show up next to any value on any of the views. The currency itself seems random, too: I do have one or two accounts denominated in HRK, but the majority is USD and PLN.

EXPECTED RESULT
The accounts to have their currencies correctly migrated.

SOFTWARE/OS VERSIONS

Linux/KDE Plasma: Ubuntu 19.04
KDE Plasma Version:  
KDE Frameworks Version: 5.56.0 
Qt Version: 5.12.2

ADDITIONAL INFORMATION
Tested with both git master and Ubuntu's 5.0.3 from the repository.
Comment 1 Thomas Baumgart 2019-06-24 16:33:02 UTC
Git commit d2dc4d7b5a9090b2a7c55b244644fa565478dc75 by Thomas Baumgart.
Committed on 24/06/2019 at 16:32.
Pushed by tbaumgart into branch '5.0'.

Fix GnuCash importer to import currencies

Support currencies that are stored with
  <cmdty:space>CURRENCY</cmdty:space>
in addition to ones stored with
  <cmdty:space>ISO4217</cmdty:space>.

Also, only load those currencies that are used in the GnuCash file.
FIXED-IN: 5.0.5

M  +27   -21   kmymoney/plugins/gnc/import/mymoneygncreader.cpp
M  +2    -6    kmymoney/plugins/gnc/import/mymoneygncreader.h

https://commits.kde.org/kmymoney/d2dc4d7b5a9090b2a7c55b244644fa565478dc75