Bug 452497

Summary: Scheduled transactions: "Next due date", "Number remaining" and "Date of final" do not always update in step
Product: [Applications] kmymoney Reporter: Paul Worrall <p.r.worrall>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 5.1.2   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In: 5.1.3

Description Paul Worrall 2022-04-11 12:39:46 UTC
STEPS TO REPRODUCE (There are probably other ways too)
1.  Create a scheduled monthly transaction with next due date in the future
2.  Choose "This schedule will end at some time" (number of transactions remaining defaults to 0 with date = today -- OK)
3.  Increment number of transactions until it gets to 12 (date of final transaction updates correctly)
4.  Click OK to save the schedule
5.  Edit the schedule just created and decrement the number of transactions to 11 (final date updates OK)
6.  Increment the number of transactions back to 12

OBSERVED RESULT
Date of final transaction does not update in the final step

EXPECTED RESULT
Date of final transaction updates OK

SOFTWARE/OS VERSIONS
Operating System: KDE neon 5.24
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3
Kernel Version: 5.13.0-39-generic (64-bit)
Graphics Platform: X11
Processors: 2 × AMD A6-6400K APU with Radeon(tm) HD Graphics
Memory: 7.7 GiB of RAM
Graphics Processor: AMD CEDAR

ADDITIONAL INFORMATION
There is something wrong with the logic that updates these fields -- in my 'live' database I have schedules that show e.g. number of transactions = 10, but date of final corresponds to 12 payments, and if I increment the number of transactions, to 11 it decreases the date of final to correspond correctly.

A consequence also seems to be that reports that show scheduled transactions do not show the right number.
Comment 1 Thomas Baumgart 2022-04-15 08:24:51 UTC
Git commit 094402a1467835376a6af84bfa7cbbd97ac6be59 by Thomas Baumgart.
Committed on 15/04/2022 at 08:07.
Pushed by tbaumgart into branch 'master'.

Fix syncing of number of payments and last payment date

M  +4    -8    kmymoney/views/keditscheduledlg.cpp

https://invent.kde.org/office/kmymoney/commit/094402a1467835376a6af84bfa7cbbd97ac6be59
Comment 2 Thomas Baumgart 2022-04-15 08:25:11 UTC
Git commit 50b17feec4c0eb853076125ba1b9a6c091ae5c8a by Thomas Baumgart.
Committed on 15/04/2022 at 08:21.
Pushed by tbaumgart into branch '5.1'.

Fix syncing of number of payments and last payment date
FIXED-IN: 5.1.3

M  +5    -11   kmymoney/dialogs/keditscheduledlg.cpp

https://invent.kde.org/office/kmymoney/commit/50b17feec4c0eb853076125ba1b9a6c091ae5c8a