Bug 333949 - kmymoney won't match or allow manual matching on two imports or two manual transactions
Summary: kmymoney won't match or allow manual matching on two imports or two manual tr...
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: git (master)
Platform: unspecified Other
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
: 334037 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-04-27 09:18 UTC by Chris
Modified: 2015-03-22 13:45 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.7.2
Sentry Crash Report:


Attachments
patch for disabled matching imported transactions (3.87 KB, patch)
2014-11-15 13:53 UTC, Wood
Details
Patch to remove restrictions on matching of any imported transactions. (5.81 KB, patch)
2015-03-16 13:25 UTC, allan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chris 2014-04-27 09:18:23 UTC
When importing from two different sources (csv) transactions are not matched. Manual matching is disabled.

While it is known that this is by design. The recent conversation on kmymoney-devel has not produced a reason for this design choice.

As more and more transactions are entered by importing only, this is very inconvenient. 

An example is when importing both credit card statements and then bank account statements. payments from the bank account onto the credit card (using payee assignment) are not matched and cannot be manually matched. This leaves the credit card balance to be incorrect.

Reading the documentation says deleting one of the transactions rather than matching can result in an error. but as manual matching is not available you have little choice.

Disabling the checks surrounding this 'bug/feature' allows the transactions to be manually matched without apparent side effect.

Recommended fixes include 

1/ Disabling the checks when manually matching and allow the transactions to be matched, as the user has to decide to do this, this should not be a problem.

2/ Removing the restrictive code and allow matching to proceed even when both transactions are imported (but have separate sources as in my example)

3/ Same as 2 but popping up a message to ask if this is required. This may resolve edge cases.

As this is a design choice it would be nice to know why the decision was made If my above three choices doesn't cover the reason another arrangement may work.

Reproducible: Always




This bug is related to
https://bugs.kde.org/show_bug.cgi?id=278753
Comment 1 Chris 2014-04-29 08:55:55 UTC
I am happy to work on this. But to do so I need some guidance. particularly as to the reasoning behind the original decision.

Can I also suggest bug 334037  https://bugs.kde.org/show_bug.cgi?id=334037 be marked as a duplicate of this bug.
Comment 2 Cristian Oneț 2014-07-31 14:01:06 UTC
*** Bug 334037 has been marked as a duplicate of this bug. ***
Comment 3 Cristian Oneț 2014-07-31 14:02:38 UTC
Feel free to submit a patch trough https://git.reviewboard.kde.org/ I don't know the reason behind the original design decision.
Comment 4 allan 2014-08-01 21:07:05 UTC
On 31/07/14 15:02, Cristian Oneț  wrote:
> https://bugs.kde.org/show_bug.cgi?id=333949
>
> Cristian Oneț <onet.cristian@gmail.com> changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |onet.cristian@gmail.com
>
> --- Comment #3 from Cristian Oneț <onet.cristian@gmail.com> ---
> Feel free to submit a patch trough https://git.reviewboard.kde.org/ I don't
> know the reason behind the original design decision.
>

Might it have been intended as a precaution against importing the same 
file twice, with QIF transactions having no unique id, perhaps?

Allan
Comment 5 pub-yannick 2014-08-07 04:20:37 UTC
I think so but as Chris wrote, a option that can allows to overpass this retriction could be usefull for some usage.
Comment 6 george 2014-08-27 01:48:44 UTC
This has come up A LOT in moving from Quicken to KMM.  All the imported stuff with in the download timeframe ends up being duplicated, possibly with differing payees.  

I would suggest that if one of the items to be matched came from "other program" rather than from a download, one should use the fields that differ from that import. Quicken and KMM both allow aliasing of payee names.  This might also be a point where the discovered alias could be put into the KMM payee data.
Comment 7 Wood 2014-11-14 05:27:26 UTC
Has anybody made any progress working on this bug ? Importing online transactions is really painful as it creates a lot of duplicates. I have a relatively small patch that fixes this, it enables the manual matching between two transactions as long as some reasonable parameters of transactions are identical (date, amount, size, etc).
Comment 8 allan 2014-11-14 11:05:12 UTC
There was a hope that a patch would be put forward, but sadly that seems not to have progressed since April, so I think it would be good if you could provide your patch.

The usual path for submissions is via reviewboard - https://git.reviewboard.kde.org - which is good for reviewing patches, but if yours is fairly small, and associated witha bug, I would attach it here.
Comment 9 Wood 2014-11-15 13:53:29 UTC
Created attachment 89597 [details]
patch for disabled matching imported transactions

See the attached patch
Comment 10 Swj 2014-11-24 20:59:49 UTC
I've noticed a new  matching problem in version 4.7.1, not sure if its the same thing?
My credit card bill is paid from my checking account and when I auto ofx update  the  credit card account, KMM automatically creates the payment transaction in my checking account. In KMM 4.6.4 if I auto ofx update my checking account after the credit card account then the update will match the  downloaded payment ofx transaction with the  created payment transaction. But KMM 4.7.1 does not do this match so there seems to be no way of avoiding having duplicate transactions.

There is also a 2nd matching problem of if I auto ofx update the checking account first, then when I auto update the credit card account it creates the payment transaction in checking account but this doesn't get matched with downloaded ofx transaction.  This I could workaround in 4.6.4 by deleting the ofx transaction and doing the ofx update again on the checking account.
Comment 11 allan 2015-01-10 12:06:21 UTC
(In reply to Wood from comment #9)
> Created attachment 89597 [details]
> patch for disabled matching imported transactions
> 
> See the attached patch

I'm doing some catching up with my own accounts, and noticed that I was unable to match two imported transactions - a problem which I thought had been fixed, but it seems loke your suggested patch hasn't been progressed.
This is not my area, but I might as well give your patch a wizz.
Comment 12 allan 2015-01-10 23:04:43 UTC
The patch deals with two imported transactions, but not two manual ones for me.  I get an exception, "Second transaction does not match requirement for matching" after line 71 -
'if (!ti.isImported()) { ' - in transactionmatcher.cpp .
Comment 13 Wood 2015-01-11 18:28:04 UTC
So first of all with respect to the inital patch, I was expecting someone to apply it to the source tree but it seems that aside you, nobody else tried it. What would be the best way of going forward? It solved for me a lot of issues with unmatched imported transactions. 

I didn't try to match manual transactions so I didn't run into the bug you seem to experience but I can definitevly try to see what is going on. More generaly, the code that deals with matching transactions is maybe a little bit too restrictive and I don't quite understand why. Do you think it's worth working on it? I think one of the possible solution would be to ask the user what to do. This being said, I would rather avoid working on code that will never be merged back...
Comment 14 allan 2015-01-11 23:10:24 UTC
(In reply to Wood from comment #13)
> So first of all with respect to the inital patch, I was expecting someone to
> apply it to the source tree but it seems that aside you, nobody else tried
> it. What would be the best way of going forward? It solved for me a lot of
> issues with unmatched imported transactions. 

This certainly will be useful and I'll follow up, but see below.

> I didn't try to match manual transactions so I didn't run into the bug you
> seem to experience but I can definitevly try to see what is going on. More
> generaly, the code that deals with matching transactions is maybe a little
> bit too restrictive and I don't quite understand why. Do you think it's
> worth working on it? I think one of the possible solution would be to ask
> the user what to do. This being said, I would rather avoid working on code
> that will never be merged back...

The manual matching of transactions was raised by the OP, but he seems to
have gone off-line, so we'll concentrate on matching imports.  If you could, 
would you have a look at strings in messages and comments, for references to
matching two imported transactions.  With that tidy up, I think we can progress this.

Thanks for your work.
Comment 15 george 2015-01-12 16:19:47 UTC
I am not sure this is exactly on topic, but I am having trouble matching scheduled transactions with downloaded ones.  The first issue seems to be the inability to select the two transactions if there is a seperator in the "Ledger" such as "Last week" or "Online Statement Balance:...".  This seems to be a pure selection issue.  Beyond that, once selected, often Match is not offered as an option on the mouse-3 menu (i.e. it is grayed out).
Comment 16 allan 2015-01-13 12:10:15 UTC
On 12/01/15 16:19, george@wildturkeyranch.net wrote:
> https://bugs.kde.org/show_bug.cgi?id=333949
>
> --- Comment #15 from george@wildturkeyranch.net ---
> I am not sure this is exactly on topic, but I am having trouble matching
> scheduled transactions with downloaded ones.  The first issue seems to be the
> inability to select the two transactions if there is a seperator in the
> "Ledger" such as "Last week" or "Online Statement Balance:...".  This seems to
> be a pure selection issue.  Beyond that, once selected, often Match is not
> offered as an option on the mouse-3 menu (i.e. it is grayed out).
>

I think it would be as well to make this a new bug.

I don't usually use the separators but have just tried to reproduce your 
problem, without success.

  I think you may need to supply a file demonstrating the issue/s.

Allan
Comment 17 allan 2015-02-09 17:06:16 UTC
The patch kindly provided by w00dp@mail.com gives the capability to match two imported transactions.  I need to do some more work though to revise the various messages.

In addition, within the code itself, there is a number of variables with names, some abbrviated,  which reflect the original functionality.

I'm trying not to add to the patch size, but would it be as well, from the point of view of future readability, to bring up to date these names?  For instance, in transactionmatcher.cpp, at line 30
we have -
void TransactionMatcher::match(MyMoneyTransaction tm, MyMoneySplit sm, MyMoneyTransaction ti, MyMoneySplit si, bool allowImportedTransactions)
Presumably, tm means transaction-matched sm means split-matched, ti = transaction-imported and si = split-imported, for example.  These could become xxx-first and xxx-second, or similar?
Comment 18 allan 2015-03-16 13:25:05 UTC
Created attachment 91579 [details]
Patch to remove restrictions on matching of any imported transactions.

Have now removed the restrictions on matching of any imported transactions.

The original patch by w00dp@mail.com has been available here for some while, 
but I'll wait a few more days before pushing this patch.
Comment 19 allan 2015-03-16 22:38:42 UTC
(In reply to allan from comment #18)
> Created attachment 91579 [details]
> Patch to remove restrictions on matching of any imported transactions.
> 
> Have now removed the restrictions on matching of any imported transactions.
> 
> The original patch by w00dp@mail.com has been available here for some while, 
> but I'll wait a few more days before pushing this patch.

Repeated as original did not appear on Dev list.
Comment 20 allan 2015-03-21 17:51:01 UTC
Git commit 765c9be5e0e9d7d3f6527d2d9924b301375a390b by Allan Anderson.
Committed on 15/03/2015 at 12:14.
Pushed by allananderson into branch 'master'.
Allow matching of two non-imported transactions.

with thanks to w00dp@mail.com

M  +11   -5    kmymoney/dialogs/transactionmatcher.cpp
M  +22   -13   kmymoney/kmymoney.cpp
M  +2    -1    kmymoney/mymoney/mymoneysplit.cpp
M  +2    -1    kmymoney/widgets/stdtransactionmatched.cpp

http://commits.kde.org/kmymoney/765c9be5e0e9d7d3f6527d2d9924b301375a390b
Comment 21 allan 2015-03-21 17:51:02 UTC
Git commit 375b5cd42a00dca9a0a6b75e2700e0c4aa6cafc5 by Allan Anderson.
Committed on 15/03/2015 at 12:14.
Pushed by allananderson into branch 'master'.
Remove restrictions on matching of any imported transactions.

with thanks to w00dp@mail.com for the initial patch.

M  +1    -6    kmymoney/dialogs/transactionmatcher.cpp

http://commits.kde.org/kmymoney/375b5cd42a00dca9a0a6b75e2700e0c4aa6cafc5
Comment 22 allan 2015-03-21 17:51:03 UTC
Git commit 98bbab9c57e6f91e78fe60048b240fbc7d60c0bd by Allan Anderson.
Committed on 15/03/2015 at 12:14.
Pushed by allananderson into branch 'master'.
Remove restrictions on matching of any imported transactions.

with thanks to w00dp@mail.com for the initial patch.

M  +4    -4    kmymoney/kmymoney.cpp

http://commits.kde.org/kmymoney/98bbab9c57e6f91e78fe60048b240fbc7d60c0bd
Comment 23 allan 2015-03-21 17:51:04 UTC
Git commit 93702c8a081b3f970aae4ebec598cc74ca909dea by Allan Anderson.
Committed on 15/03/2015 at 12:14.
Pushed by allananderson into branch 'master'.
Remove restrictions on matching of any imported transactions.

with thanks to w00dp@mail.com for the initial patch.

M  +1    -1    kmymoney/dialogs/transactionmatcher.cpp

http://commits.kde.org/kmymoney/93702c8a081b3f970aae4ebec598cc74ca909dea
Comment 24 allan 2015-03-21 17:51:04 UTC
Git commit 9f5477195f050e8f28e238fc81db4f6fe1c753ae by Allan Anderson.
Committed on 15/03/2015 at 12:14.
Pushed by allananderson into branch 'master'.
Remove restrictions on matching of any imported or manual transactions.
Tidy up.

with thanks to w00dp@mail.com for the initial patch.

M  +6    -0    kmymoney/dialogs/transactionmatcher.cpp

http://commits.kde.org/kmymoney/9f5477195f050e8f28e238fc81db4f6fe1c753ae
Comment 25 allan 2015-03-22 13:45:00 UTC
Git commit 48cc7c560fc989e2437724217f78c0992ca5026a by Allan Anderson.
Committed on 15/03/2015 at 12:14.
Pushed by allananderson into branch '4.7'.
Allow matching of two non-imported transactions.

with thanks to w00dp@mail.com

M  +11   -5    kmymoney/dialogs/transactionmatcher.cpp
M  +22   -13   kmymoney/kmymoney.cpp
M  +2    -1    kmymoney/mymoney/mymoneysplit.cpp
M  +2    -1    kmymoney/widgets/stdtransactionmatched.cpp

http://commits.kde.org/kmymoney/48cc7c560fc989e2437724217f78c0992ca5026a
Comment 26 allan 2015-03-22 13:45:01 UTC
Git commit cefde1bb04e87b7889f00917361bbb88a712f872 by Allan Anderson.
Committed on 15/03/2015 at 12:14.
Pushed by allananderson into branch '4.7'.
Remove restrictions on matching of any imported transactions.

with thanks to w00dp@mail.com for the initial patch.

M  +1    -6    kmymoney/dialogs/transactionmatcher.cpp

http://commits.kde.org/kmymoney/cefde1bb04e87b7889f00917361bbb88a712f872
Comment 27 allan 2015-03-22 13:45:02 UTC
Git commit 2c8ef6d46b0c20880152482600dd91c57c61b07f by Allan Anderson.
Committed on 15/03/2015 at 12:14.
Pushed by allananderson into branch '4.7'.
Remove restrictions on matching of any imported transactions.

with thanks to w00dp@mail.com for the initial patch.

M  +4    -4    kmymoney/kmymoney.cpp

http://commits.kde.org/kmymoney/2c8ef6d46b0c20880152482600dd91c57c61b07f
Comment 28 allan 2015-03-22 13:45:02 UTC
Git commit 61ea11eedf29e5f0a1a518f309ce6f35e495d82e by Allan Anderson.
Committed on 15/03/2015 at 12:14.
Pushed by allananderson into branch '4.7'.
Remove restrictions on matching of any imported transactions.

with thanks to w00dp@mail.com for the initial patch.

M  +1    -1    kmymoney/dialogs/transactionmatcher.cpp

http://commits.kde.org/kmymoney/61ea11eedf29e5f0a1a518f309ce6f35e495d82e
Comment 29 allan 2015-03-22 13:45:03 UTC
Git commit 7e7a50e39170d03c9fe83ffcbe394d485cefaf52 by Allan Anderson.
Committed on 15/03/2015 at 12:14.
Pushed by allananderson into branch '4.7'.
Remove restrictions on matching of any imported or manual transactions.
Tidy up.

with thanks to w00dp@mail.com for the initial patch.

M  +6    -0    kmymoney/dialogs/transactionmatcher.cpp

http://commits.kde.org/kmymoney/7e7a50e39170d03c9fe83ffcbe394d485cefaf52