Version: unspecified (using KDE 4.4.5) OS: Linux When creating Loan account when I lend money the Account creation wizard ands with a dialog: Unable to create account: Account has invalid type Version: 3.98.1 and 3.98.2-svn1159082 Reproducible: Didn't try Steps to Reproduce: Create account Choose account type "Loan" Choose What is the type of the loan? "I am lending money" Continue
Reproducible: Didn't try --- sory Reproducible: Always
I can confirm this.
Hint for the developers: the problem is that if money is lent the account type is set to m_account.setAccountType(MyMoneyAccount::AssetLoan); which is not present in the account type combo which is the final source of the account type thus resulting in an Unknown account type. Suggestion: use m_account as the final source of account instead of the account type combo.
SVN commit 1159736 by asoliverez: Fixed how the account type is assigned to the account type combo when it is a loan BUG:246815 M +6 -1 knewaccountwizard.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1159736
I'm afraid that this fix is not correct since when the user will lend money an account with type 'Loan' instead of one with type 'AssetLoan' will be created which is a BUG.
What do you mean? I tried it and it creates an Investment Loan account, which is the AssetLoan type.
That is what's displayed in the summary page or is it the type of the account that was saved in the kmymoney file?
(In reply to comment #7) > That is what's displayed in the summary page or is it the type of the account > that was saved in the kmymoney file? I'm saying this because after displaying the summary account the account() method of the wizard will be called again and it will set the type of the saved account to 'Loan' because that's in the combobox.
Actually, that display on the summary page is done on purpose. It beats me why they did it, but that's existing code. ----------------------- if (acc.accountType() == MyMoneyAccount::AssetLoan) m_dataList->append(QString(i18n("Type") + ": %1").arg(i18n("Loan"))); else m_dataList->append(QString(i18n("Type") + ": %1").arg(m_wizard->m_accountTypePage->m_typeSelection->currentText())); ----------------------- Finish the wizard and you'll see it creates an asset loan.
(In reply to comment #9) > Actually, that display on the summary page is done on purpose. It beats me why > they did it, but that's existing code. > > ----------------------- > if (acc.accountType() == MyMoneyAccount::AssetLoan) > m_dataList->append(QString(i18n("Type") + ": %1").arg(i18n("Loan"))); > else > m_dataList->append(QString(i18n("Type") + ": > %1").arg(m_wizard->m_accountTypePage->m_typeSelection->currentText())); > ----------------------- > > Finish the wizard and you'll see it creates an asset loan. I'll test this when I get home but frankly I don't see how finishing the wizard will create an account of type 'MyMoneyAccount::AssetLoan'. Isn't the last call to Wizard::account() done in KMyMoneyApp::slotAccountNew() wizard->account()? Which in turn will set the account type to m_account.setAccountType(m_accountTypePage->accountType()); which in turn is set by your commit to 'MyMoneyAccount::Loan', is this right?
I was missing the following code in the account() method: ------------------------------ if (m_account.isLoan()) { // in case we lend the money we adjust the account type if (!moneyBorrowed()) m_account.setAccountType(MyMoneyAccount::AssetLoan); ------------------------------ So I guess we can close this as fixed. Thanks for the discussion :).