Bug 276315

Summary: Illogical message when editing investment
Product: [Applications] kmymoney Reporter: allan <agander93>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: SVN   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:

Description allan 2011-06-23 11:28:58 UTC
Version:           SVN trunk (using KDE 4.6.0) 
OS:                Linux

When manually adding an account to an IntInc record that has been flagged during import, on entering the edited transaction, the Exchange Rate/Price wizard pops up, asking to convert from GBP to GBP.
It also shows if an unflagged DivX has its value edited.  Apart from the illogicality of wishing to convert from GBP to GBP, there is the question of why a currency/price editor shows when no price is involved.

I've had a look at this, and what seems to be the problem, is that this
occurs if the transaction in question has a category which has been
created during import.  If the category is created beforehand, the
currency wizard doesn't open.  It seems to be because, in
investmementtransactioneditor.cpp, circa line 887,
acc.currencyId() != t.commodity()) , because t.commodity() = GBP, and acc.currencyId() (say, for a Dividend category) is empty.

As this is in the routine InvestTransactionEditor::setupPrice(), eventually I decided that the root cause was probably that that routine should not have been called.

Eventually I worked back to Activity::createCategorySplits and made the following change at line 119 -
if ((!s1.value().isZero()) && (!s1.actualPrice().isZero())){
          rc = m_parent->setupPrice
and adding in that test for a zero price appears to fix the problem.

Reproducible: Always

Steps to Reproduce:
1) Import a cash dividend transaction into a file that does not have a 'Dividend' category.
2) Open that transaction in the ledger and edit it.
3) Accept the change.



Actual Results:  
4) Currency/Price editor wizard opens.

Expected Results:  
Currency/Price editor wizard should not intervene.

I'll add to reviewboard.
Comment 1 allan 2011-06-28 10:04:28 UTC
I need to look again at this.  The fix works for Dividends, where no price is involved, but I think the odd currency/price wizard still shows for ReinvDiv/Buy transactions, where there is a price.
Comment 2 allan 2011-07-04 14:46:53 UTC
Mea culpa.

When I re-wrote MyMoneyStatementReader::Private::nameToId(), in order to handle categories with sub-categories, I borrowed some code from KMyMoneyApp::createAccount(), pruning it in the process.

What I should not have omitted was the creation of a currencyId for the new category.
Comment 3 allan 2011-07-05 19:41:30 UTC
SVN commit 1239913 by allananderson:

BUG:276315
REVIEW:6732

When I re-wrote MyMoneyStatementReader::Private::nameToId(), in order to handle
categories with sub-categories, I borrowed some code from
KMyMoneyApp::createAccount(), pruning it in the process.

What I should not have omitted was the creation of a currencyId for the new
category.

 M  +5 -0      mymoneystatementreader.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1239913