Bug 498401

Summary: Incorrect price output in "Show transaction details" dialog for "add/remove shares" investment transactions
Product: [Applications] kmymoney Reporter: Ralf Habacker <ralf.habacker>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: 5.1.90   
Target Milestone: ---   
Platform: Other   
OS: All   
Latest Commit: Version Fixed In: 5.2
Sentry Crash Report:
Attachments: Screenshot showing the issue

Description Ralf Habacker 2025-01-08 22:33:00 UTC
Created attachment 177213 [details]
Screenshot showing the issue

The attached test file shows an error in the output of prices for investment transactions of the type ‘Add/Remove shares’.

STEPS TO REPRODUCE
1. open the attached file, with a snapshot of kmymoney
2. configure a keyboard shortcut for the function ‘Show transaction details’ e.g. CTRL-SHIFT-D
2. open the general ledger of the account Assets->shares->BHP
3. select the transaction ‘Add shares’ and press CTRL-SHIFT-D

OBSERVED RESULT
The attribute ‘Price’ in the displayed transactions shows ‘1/1’

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
Comment 1 Jack 2025-01-09 00:08:47 UTC
From what I understand, this is not a display issue, as that (1/1) is the value actually stored in the transaction.  Is the answer to explicitly test for this type of transaction and display 0 or to change what is stored in such transactions.
Comment 2 Ralf Habacker 2025-01-21 18:57:12 UTC
(In reply to Jack from comment #1)
> From what I understand, this is not a display issue, as that (1/1) is the
> value actually stored in the transaction.  

yes 

> to change what is stored in such transactions.

This solution has been requested at https://invent.kde.org/office/kmymoney/-/merge_requests/252#note_1102237 and will be fixed with https://invent.kde.org/office/kmymoney/-/merge_requests/256.
Comment 3 Ralf Habacker 2025-01-21 21:06:53 UTC
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 498356
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