Bug 445472 - Stock split transactions can cause rounding problems
Summary: Stock split transactions can cause rounding problems
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: 5.1.2
Platform: unspecified All
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-14 12:08 UTC by Thomas Baumgart
Modified: 2021-11-14 12:23 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Baumgart 2021-11-14 12:08:52 UTC
SUMMARY
The balance after a stock split transaction was not rounded accurately to the precision defined for the security causing the balance to deviate.

STEPS TO REPRODUCE
1. Open the demo file attached to bug 445458
2. Open the ledger for account named "Methprofits"

OBSERVED RESULT
Investment value displayed below the ledger shows -0.01$

EXPECTED RESULT
Investment value displayed below the ledger shows 0.00$ just like the balance column of the last transaction
Comment 1 Thomas Baumgart 2021-11-14 12:23:22 UTC
Git commit 20b07baa8a999ca606cbf86019f2aa2470da547d by Thomas Baumgart.
Committed on 14/11/2021 at 12:22.
Pushed by tbaumgart into branch '5.1'.

Prevent fractions during stock split operations

Always round to the account fraction of the investment's security when
performing a stock split.
FIXED-IN: 5.1.3

M  +4    -0    kmymoney/mymoney/mymoneyenums.h
M  +6    -0    kmymoney/mymoney/mymoneyfile.cpp
M  +8    -0    kmymoney/mymoney/mymoneyfile.h
M  +11   -1    kmymoney/mymoney/storage/mymoneystoragemgr.cpp
M  +3    -0    kmymoney/mymoney/storage/mymoneystoragemgr.h
M  +52   -17   kmymoney/mymoney/storage/mymoneystoragemgr_p.h
M  +6    -2    kmymoney/views/kgloballedgerview_p.h

https://invent.kde.org/office/kmymoney/commit/20b07baa8a999ca606cbf86019f2aa2470da547d