Created attachment 109848 [details] 1 line test file for investment transaction import When trying to import investment transactions from brokerage as .csv file, import fails after mapping fields with popup "The values in the columns you have selected do not match any expected investment type", and all other types from the drop down menu are grayed out. It even fails after modifying .csv file to use sample type in the Merrill Lynch template in the csvimporterrc file. Since option to reassign type are all grayed out (another issue?), the only option is to abort the import. The proper action in the sample case would be to recognize "dividend" as a valid brokerage transaction and deposit the amount in the "brokerage" account of the corresponding investment account. The error occurs before the investment account is selected. The csvimporterrc template is the default M-L one with the columns mapped as follows: [BankProfiles] BankNames=Merril Lynch,Schwab PriorInvProfile=Merril Lynch [MainWindow] Height=174 Width=866 [Profiles-Merril Lynch] AmountCol=7 BrokerageParam=Bill Payment,Check,dividend,interest,qualified div,foreign tax paid,adr mgmt fee BuyParam=buy DateCol=1 DateFormat=2 DecimalSymbol=0 DetailCol=9 DivXParam=Dividend Encoding=0 FeeCol=6 FieldDelimiter=0 FileType=Invest Filter= IntIncParam=Interest,Income InvDirectory=~/ MemoCol=2 PayeeCol=3 PriceCol=5 PriceFraction=2 ProfileName=Merril Lynch QuantityCol=4 ReinvdivParam=reinvest,Reinv,Re-inv,ReInv RemoveParam=Remove SecurityName=-1 SellParam=Sell,Repurchase ShrsinParam=Add,Stock Dividend,Divd Reinv,Transfer In,Re-Registration In,Journal Entry StartLine=0 SymbolCol=8 TrailerLines=0
Looking through the latest code I believe the cause of this issue involves the referenced code below. The isComplete() function of the qWizardPage forces the selection of quantity, price, and amount before the next button can be clicked. When the transactions are processed, a list of valid action types (the ones that don't show as grayed-out in the manual assignment dialog as mentioned) is generated by createValidActionTypes, which will only allow the dividend action type if the shares and prices are zero while the amount is positive. Thus, I have successfully been able to import dividend transactions by manipulating the input CSV to ensure the values of price and quantity for dividend transactions is 0. I am unsure if this is intended or a bug but the raw data I receive from my broker includes share amount and price for dividend transactions. Since dividend transactions in KMyMoney are only stored as an amount, perhaps the easiest solution would be to modify createValidActionTypes to allow dividend transactions when the shares and price amounts are non-zero, then simply ignore these fields when storing the transaction. investmentwizardpage.cpp:156 bool InvestmentPage::isComplete() const { return ui->m_dateCol->currentIndex() > -1 && ui->m_typeCol->currentIndex() > -1 && ui->m_quantityCol->currentIndex() > -1 && ui->m_priceCol->currentIndex() > -1 && ui->m_amountCol->currentIndex() > -1 && ui->m_priceFraction->currentIndex() > -1; } csvimportercore.cpp:1232 QList<eMyMoney::Transaction::Action> CSVImporterCore::createValidActionTypes(MyMoneyStatement::Transaction &tr) { QList<eMyMoney::Transaction::Action> validActionTypes; if (tr.m_shares.isPositive() && tr.m_price.isPositive() && !tr.m_amount.isZero()) validActionTypes << eMyMoney::Transaction::Action::ReinvestDividend << eMyMoney::Transaction::Action::Buy << eMyMoney::Transaction::Action::Sell; else if (tr.m_shares.isZero() && tr.m_price.isZero() && !tr.m_amount.isZero()) validActionTypes << eMyMoney::Transaction::Action::CashDividend << eMyMoney::Transaction::Action::Interest; else if (tr.m_shares.isPositive() && tr.m_price.isZero() && tr.m_amount.isZero()) validActionTypes << eMyMoney::Transaction::Action::Shrsin << eMyMoney::Transaction::Action::Shrsout; return validActionTypes; }