Bug 303026 - This transaction has a missing assignment of XXX 0.01
Summary: This transaction has a missing assignment of XXX 0.01
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: 4.6.2
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
: 253007 (view as bug list)
Depends on:
Blocks: 345655
  Show dependency treegraph
 
Reported: 2012-07-04 17:29 UTC by Thomas Pircher
Modified: 2019-05-22 20:10 UTC (History)
4 users (show)

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


Attachments
Test case with the problem (7.55 KB, application/x-kmymoney)
2014-10-17 21:23 UTC, Thomas Pircher
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Pircher 2012-07-04 17:29:44 UTC
When I enter a transaction in an investment account where the price/share value has only 3 significant digits after the comma (2.2870) then I the yellow triangle in the ledger view with the message "This transaction has a missing assignment of XXX 0.01".
If I enter a figure with 4 significant digits after the comma (e.g. 2.2871) then the warning disappears.

I am aware of https://bugs.kde.org/show_bug.cgi?id=253007 but I don't think this applies here. In my case I get the warning when I enter *fewer* digits than the configured precision in the transaction, not more.

Reproducible: Always
Comment 1 Cristian Oneț 2014-08-19 20:14:35 UTC
Could you provide a test file to reproduce this?
Comment 2 Thomas Pircher 2014-10-17 21:23:59 UTC
Created attachment 89183 [details]
Test case with the problem

Attached a test case that shows the yellow triangle in the "Stocks" and in the "Stocks (Brokerage)" accounts.
The triangle shown in the transaction from 04/09/2014.

I have tested this with KMymoney 4.6.6.
In the KMyMoney settings I have a Price Precision of 6 digits.
Comment 3 Cristian Oneț 2014-10-18 11:59:01 UTC
*** Bug 253007 has been marked as a duplicate of this bug. ***
Comment 4 Cristian Oneț 2014-10-18 12:00:33 UTC
The problem is visible in the attached file now we just need to figure out what's causing it.
Comment 5 Cristian Oneț 2014-10-18 13:11:39 UTC
Git commit 1506b0ccacb9d4efa2b6aaeb725c2e73f5507d83 by Cristian Oneț.
Committed on 18/10/2014 at 12:57.
Pushed by conet into branch 'master'.

Fix the validation of investment transactions.

Don't ajust the values to the smallest account fraction of the
currency. This will cause roundings that will lead to the reported
validation error.

Because at 0.5 AlkValue::RoundRound can round up/down depending on
the result it could be that one split it rounded up while the other
is rounded down leading to a 0.1 error while summing them.

Having a value which is more precise than the smallest account
fraction should not cause any issues since the UI should render
the value according to this fraction anyway.

If rounding is necessary a fix rounding method should be applied
for all splits which are going to be summed up.

M  +0    -8    kmymoney/dialogs/investtransactioneditor.cpp

http://commits.kde.org/kmymoney/1506b0ccacb9d4efa2b6aaeb725c2e73f5507d83
Comment 6 Cristian Oneț 2014-10-18 13:14:08 UTC
Git commit 1a76540fbc936dd6e80cfe9faaeef7b35d0c166b by Cristian Oneț.
Committed on 18/10/2014 at 12:57.
Pushed by conet into branch '4.7'.

Fix the validation of investment transactions.

Don't ajust the values to the smallest account fraction of the
currency. This will cause roundings that will lead to the reported
validation error.

Because at 0.5 AlkValue::RoundRound can round up/down depending on
the result it could be that one split it rounded up while the other
is rounded down leading to a 0.1 error while summing them.

Having a value which is more precise than the smallest account
fraction should not cause any issues since the UI should render
the value according to this fraction anyway.

If rounding is necessary a fix rounding method should be applied
for all splits which are going to be summed up.
(cherry picked from commit 1506b0ccacb9d4efa2b6aaeb725c2e73f5507d83)

M  +0    -8    kmymoney/dialogs/investtransactioneditor.cpp

http://commits.kde.org/kmymoney/1a76540fbc936dd6e80cfe9faaeef7b35d0c166b
Comment 7 Romain Henriet 2015-11-06 16:37:54 UTC
Proposed patch does not work when reconciliating accounts : values that appear in Kmymoney and on your bank statement are not the ones that are summed to calculate the current balance.

Example : Your account has 0.01€ precision, but 2 operations have 0.001€ precision.

               Displayed |   Internally
 Op1        1.01€       |    1.014€
 Op2        2.01€       |     2.014€
Sum =     3.02€              3.028
What your bank will show on your statement is a balance of 3.02€ while Kmymoney's balance is round(3.028) = 3.03€, and you get an error when you try to reconcile your account.
Comment 8 Paul Gover 2019-05-22 20:10:51 UTC
I've just hit this problem, with the same cure (edit the price to have a non-zero final digit) in KMyMoney 5.0.3, running on Linux, encrypted database, not SQL.