Bug 445591 - Enter a dividend payment transaction in foreign currency and kmymoney crashes
Summary: Enter a dividend payment transaction in foreign currency and kmymoney crashes
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: 5.1.2
Platform: Other macOS
: NOR crash
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks: 488491
  Show dependency treegraph
 
Reported: 2021-11-16 14:35 UTC by labm.4v70
Modified: 2024-08-10 09:58 UTC (History)
1 user (show)

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


Attachments
bug description (820.75 KB, application/pdf)
2021-11-16 14:35 UTC, labm.4v70
Details
kmh file (4.30 KB, application/gzip)
2021-11-16 14:37 UTC, labm.4v70
Details
crash report (116.43 KB, application/pdf)
2021-11-16 14:39 UTC, labm.4v70
Details
Screenshot (91.54 KB, image/png)
2024-08-06 18:16 UTC, Ralf Habacker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description labm.4v70 2021-11-16 14:35:49 UTC
Created attachment 143627 [details]
bug description

SUMMARY
The value of the total amount of the dividend transaction is correct and expressed in the brokerage account currency EUR but prefixed with SEK.  
Enter the transaction and KMM crashes.


STEPS TO REPRODUCE
1. Base currency : EUR
2. Create an investment account in currency EUR and its brokerage account in currency EUR
3. In the investment account create a security in currency SEK
4. Enter a Dividend transaction with fees and dividend in SEK with conversion

OBSERVED RESULT
1. The total amount of the transaction is correct but the prefix is wrong.
2. Enter the transaction and KMM crashes (see the trace report).

EXPECTED RESULT
1. As the brokerage account is in currency EUR the total amount of the transaction should be prefixed with EUR.  The amount of Fees and Interest should also be prefixed by the corresponding currency of the category as it could be different of EUR or SEK (it is allowed by KMM in the definition of a category).
2. … no crash  

SOFTWARE/OS VERSIONS
KMyMoney : Version 5.1.2-893f55a43
Windows: 
macOS: 10.13.6 (17G14042)
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2 (built against 5.15.2)
The cocoa windowing system

ADDITIONAL INFORMATION
See attached file for :
a- a detail description with screenshots 
b- a kmymoney file to easily reproduced the problem
c- a crash report
Comment 1 labm.4v70 2021-11-16 14:37:55 UTC
Created attachment 143629 [details]
kmh file

to reproduce the bug
Comment 2 labm.4v70 2021-11-16 14:39:46 UTC
Created attachment 143630 [details]
crash report
Comment 3 Ralf Habacker 2024-08-06 13:16:43 UTC
(In reply to labm.4v70 from comment #0)

I checked this issue with an actual build of kmymoney on openSUSE Linux:

> 4. Enter a Dividend transaction with fees and dividend in SEK with conversion

After entering the required values and pressing "Enter", the booking form is closed, but no further booking is added to the general ledger. A crash does not occur on Linux. However, as something is not working properly in the background, this error may be responsible on MacOSX.
Comment 4 Ralf Habacker 2024-08-06 18:16:00 UTC
Created attachment 172353 [details]
Screenshot

(In reply to Ralf Habacker from comment #3)
...
> After entering the required values and pressing "Enter", the booking form is
> closed, but no further booking is added to the general ledger. 

To be more specific: When entering the amount for the fee a dialog pops up for the currency exchange as shown in the screenshot. Pressing "okay" closes this dialog and cancels the transaction form without any further processing of the entered transaction.
Comment 5 Thomas Baumgart 2024-08-07 12:23:57 UTC
Git commit 1fc6f91ecf4f9e0704fcafce8559e0dea1c5ae99 by Thomas Baumgart.
Committed on 07/08/2024 at 12:23.
Pushed by tbaumgart into branch 'master'.

Fix multi currency issues with investment transaction editor
FIXED-IN: 5.2

M  +35   -5    kmymoney/views/investtransactioneditor.cpp
M  +1    -0    kmymoney/widgets/amountedit.cpp

https://invent.kde.org/office/kmymoney/-/commit/1fc6f91ecf4f9e0704fcafce8559e0dea1c5ae99
Comment 6 Thomas Baumgart 2024-08-07 12:24:05 UTC
Git commit dd110e199f5a9763d2dcb0edc0691f7e05d497d3 by Thomas Baumgart.
Committed on 07/08/2024 at 12:23.
Pushed by tbaumgart into branch 'master'.

Add feature to prevent sending signals

If MyMoneyFile signals are not blocked during this operation, a crash
can happen when a price update is performed within two nested dialogs
(split dialog and the currency calculator). Blocking the signals
resolves the issue (for me).

M  +14   -0    kmymoney/dialogs/kcurrencycalculator.cpp
M  +9    -0    kmymoney/dialogs/kcurrencycalculator.h

https://invent.kde.org/office/kmymoney/-/commit/dd110e199f5a9763d2dcb0edc0691f7e05d497d3
Comment 7 Ralf Habacker 2024-08-07 17:51:48 UTC
> (In reply to Ralf Habacker from comment #3)
...
> To be more specific: When entering the amount for the fee a dialog pops up
> for the currency exchange as shown in the screenshot. Pressing "okay" closes
> this dialog and cancels the transaction form without any further processing
> of the entered transaction.

This problem has now been solved, but there is still a problem. After pressing "Okay", the currency exchange dialogue appears a second time. The dialogue is only closed after pressing "OK" again.

When I enter SEK 100 in the fee input field, the currency conversion dialogue shows €9.54 in the amount input field the first time and €9.06 the second time.
Comment 8 Thomas Baumgart 2024-08-10 09:58:08 UTC
Git commit 30e479294c4c31e2887715d550b37ac6f1eacc5f by Thomas Baumgart.
Committed on 10/08/2024 at 09:57.
Pushed by tbaumgart into branch 'master'.

Improve multi currency handling

Reuse already entered exchange rates for other splits and totals

This resolves the issue that the currency calculator is shown too many
times when entering a transaction.
FIXED-IN: 5.2

M  +1    -0    kmymoney/dialogs/CMakeLists.txt
M  +0    -1    kmymoney/dialogs/kcurrencycalculator.h
A  +142  -0    kmymoney/dialogs/kcurrencyconverter.cpp     [License: GPL(v2.0+)]
A  +52   -0    kmymoney/dialogs/kcurrencyconverter.h     [License: GPL(v2.0+)]
M  +13   -12   kmymoney/views/investtransactioneditor.cpp
M  +2    -0    kmymoney/views/investtransactioneditor.h
M  +0    -1    kmymoney/views/multitransactioneditor.cpp
M  +1    -1    kmymoney/views/multitransactioneditor.h
M  +13   -1    kmymoney/views/newspliteditor.cpp
M  +3    -1    kmymoney/views/newspliteditor.h
M  +7    -6    kmymoney/views/newtransactioneditor.cpp
M  +1    -1    kmymoney/views/newtransactioneditor.h
M  +17   -4    kmymoney/views/splitdelegate.cpp
M  +26   -0    kmymoney/views/transactioneditorbase.cpp
M  +9    -0    kmymoney/views/transactioneditorbase.h
M  +11   -1    kmymoney/widgets/amountedit.cpp
M  +5    -0    kmymoney/widgets/amountedit.h
M  +6    -0    kmymoney/widgets/creditdebitedit.cpp
M  +5    -0    kmymoney/widgets/creditdebitedit.h
M  +15   -0    kmymoney/widgets/multicurrencyedit.h

https://invent.kde.org/office/kmymoney/-/commit/30e479294c4c31e2887715d550b37ac6f1eacc5f