Created attachment 177172 [details] test file On https://bugs.kde.org/show_bug.cgi?id=498033#c12 it has been found that adding or removing shares to or from an investment account results in incorrect price information in the subsequently saved kmymoney file. STEPS TO REPRODUCE 1. open the attached file created by a recent kmymoney snapshot from the git master branch in an editor and review the transaction with id=“T000000000000000008” or id=“T000000000000000009”. OBSERVED RESULT The “Price” attribute in the mentioned transactions shows “1/1”, resulting in an incorrect investment transaction report (originally reported under bug 498033). EXPECTED RESULT The price attribute for the named transaction in the file should be “0/1”. SOFTWARE/OS VERSIONS Operating System: openSUSE Leap 15.6 KDE Plasma Version: 5.27.11 KDE Frameworks Version: 5.115.0 Qt Version: 5.15.12
A possibly relevant merge request was started @ https://invent.kde.org/office/kmymoney/-/merge_requests/256
Git commit b62d4334950e82360822501c093b9752b65e189e by Ralf Habacker. Committed on 21/01/2025 at 19:02. Pushed by habacker into branch 'master'. Fix saving zero prices for newly added "add/remove shares" transactions M +1 -1 kmymoney/plugins/sql/mymoneystoragesql_p.h M +1 -3 kmymoney/plugins/xml/mymoneyxmlwriter.cpp https://invent.kde.org/office/kmymoney/-/commit/b62d4334950e82360822501c093b9752b65e189e
Git commit 39ac4b0d06d18788eb048c9d566a1a6623f153bf by Ralf Habacker. Committed on 21/01/2025 at 19:01. Pushed by habacker into branch 'master'. Rename MyMoneySplit::price() to possibleCalculatedPrice() The previously used method for querying the price performs additional calculations that are not suitable for saving in files and other output. In order to be able to query the price without further adjustments, the current method has been renamed and an additional method has been added. M +3 -3 kmymoney/converter/mymoneystatementreader.cpp M +4 -3 kmymoney/kmymoney.cpp M +6 -0 kmymoney/mymoney/mymoneysplit.cpp M +10 -4 kmymoney/mymoney/mymoneysplit.h M +1 -1 kmymoney/mymoney/splitmodel.cpp M +4 -4 kmymoney/mymoney/storage/journalmodel.cpp M +22 -9 kmymoney/mymoney/tests/mymoneysplit-test.cpp M +2 -0 kmymoney/mymoney/tests/mymoneysplit-test.h M +1 -1 kmymoney/plugins/csv/export/csvwriter.cpp M +1 -1 kmymoney/plugins/qif/export/mymoneyqifwriter.cpp M +1 -1 kmymoney/plugins/sql/mymoneystoragesql_p.h M +8 -6 kmymoney/plugins/views/reports/core/querytable.cpp M +2 -2 kmymoney/plugins/xml/mymoneyxmlwriter.cpp M +1 -1 kmymoney/views/investactivities.cpp M +2 -2 kmymoney/views/investtransactioneditor.cpp https://invent.kde.org/office/kmymoney/-/commit/39ac4b0d06d18788eb048c9d566a1a6623f153bf
Git commit 3c472000438f06c0ba7532023dfc3c886cd219cd by Ralf Habacker. Committed on 21/01/2025 at 19:03. Pushed by habacker into branch 'master'. Adjust test file for investment reports M +6 -6 kmymoney/plugins/views/reports/core/tests/data/test-investment.xml https://invent.kde.org/office/kmymoney/-/commit/3c472000438f06c0ba7532023dfc3c886cd219cd
Git commit 402d639624ddc7231f06e66a639651ff1fde93fd by Ralf Habacker. Committed on 21/01/2025 at 19:02. Pushed by habacker into branch 'master'. Fix loading of incorrect split prices for present "add/remove shares" transactions Related: bug 498401 FIXED-IN:5.2 M +32 -1 kmymoney/kmymoney.cpp M +1 -1 kmymoney/mymoney/mymoneyfile.h https://invent.kde.org/office/kmymoney/-/commit/402d639624ddc7231f06e66a639651ff1fde93fd