Bug 421750

Summary: Scheduled monthly transaction will only change first date
Product: [Applications] kmymoney Reporter: Ian Neal <iann_bugzilla>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal CC: dev.rszczesiak, me
Priority: NOR    
Version: git (master)   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 5.1.0
Sentry Crash Report:
Attachments: Test kmy that demonstrates the issue
Test case created in 5.0.6

Description Ian Neal 2020-05-19 00:25:29 UTC
SUMMARY
A scheduled monthly transaction will only change the day of the month for first transaction

STEPS TO REPRODUCE
1. Create a monthly transaction for 22nd of month
2. Check they all show for 22nd of each month
3. Edit monthly transaction to be 24th of month instead
4. Check dates for future transactions

OBSERVED RESULT
1. First future transaction is on 24th but all further ones are on 22nd

EXPECTED RESULT
1. All future transactions are on 24th

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Fedora 30
(available in About System)
KDE Plasma Version: 5.15
KDE Frameworks Version: 5.68.0
Qt Version: 5.12.5

ADDITIONAL INFORMATION
Workaround is to delete the scheduled transaction and recreate for 24th
Comment 1 Jack 2020-05-19 00:36:50 UTC
I can't reproduce this using git head 5.0 branch.  I changed to show 90+ days in the future in the ledger so I can see the next three scheduled transactions, and they all show the same day of the month when I change it.

I'm on frameworks 5.67.0, plasma 5.17.5, and qt 5.14.2.

I used a plain payment from a savings account.  Might the type of account matter?
Comment 2 Ian Neal 2020-05-19 00:45:44 UTC
(In reply to Jack from comment #1)
> I can't reproduce this using git head 5.0 branch.  I changed to show 90+
> days in the future in the ledger so I can see the next three scheduled
> transactions, and they all show the same day of the month when I change it.
> 
> I'm on frameworks 5.67.0, plasma 5.17.5, and qt 5.14.2.
> 
> I used a plain payment from a savings account.  Might the type of account
> matter?
I've pulled the latest master.
This is on a checking account.
One thing I forgot to add is that the scheduled transaction has an ending date. I have mine set to 10 transactions remaining. Can you try with that?
Comment 3 Robert Szczesiak 2020-05-19 06:35:10 UTC
I tried to reproduce the issue for the following conditions:
* master branch
* checking account
* end after 10 occurrences
* original due date set to 22 may 2020, then changed to 24 may 2020
* ledger preview set to 90 days

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.18.4
KDE Frameworks Version: 5.69.0
Qt Version: 5.14.2

I could not reproduce the issue. Works good for me.
Comment 4 Ian Neal 2020-05-19 08:05:55 UTC
Created attachment 128601 [details]
Test kmy that demonstrates the issue

I've created a test kmy file which demonstrates the issue.
Monthly scheduled transfer created for 22nd May with limit of 10
If you try to change to 24th of month, only first one changes.

I have my preview set to 500 days
Comment 5 Robert Szczesiak 2020-05-19 08:21:17 UTC
I can confirm the issue exists when reproduced from your test file. Frankly, when I once again tried to reproduce the issue on my private accounts, I could not - it worked just fine.

Seems like the KMM build on which the file was created has something to do with it...
Comment 6 Ian Neal 2020-05-19 08:32:56 UTC
Created attachment 128603 [details]
Test case created in 5.0.6

This is a similar file created on another computer using 5.0.6 (latest that ships with Fedora 30) and it shows the same issue.
Comment 7 Ian Neal 2020-05-19 08:33:52 UTC
Also note in both examples it is a transfer between accounts, so could it be related to that?
Comment 8 Robert Szczesiak 2020-05-19 08:45:22 UTC
Yes, I had noticed that the scheduled transaction is a transfer and therefore tried again on my private accounts. No success. 

So both your computers run Fedora 30, right?
Comment 9 Ian Neal 2020-05-19 08:53:58 UTC
(In reply to Robert Szczesiak from comment #8)
> Yes, I had noticed that the scheduled transaction is a transfer and
> therefore tried again on my private accounts. No success. 
> 
> So both your computers run Fedora 30, right?

Yes, both run Fedora 30.
Comment 10 Thomas Baumgart 2020-05-19 15:43:38 UTC
The option 'schedule ends after or on' makes the difference. If I turn it off in your demo file then the date changes in the ledger for all months not only the first payment.
Comment 11 Thomas Baumgart 2020-05-19 20:06:54 UTC
Git commit 7d54d8f0c96e11a9d36545fa3ee1a89b1eb3c3bb by Thomas Baumgart.
Committed on 19/05/2020 at 20:06.
Pushed by tbaumgart into branch '5.0'.

Update start date of scheduled transactions

In case an end date was specified for a scheduled transaction and the
next due date was changed by the user after the scheduled transaction
was created, the date of the following transactions was not updated.

This change makes sure that the following transactions are also shown
and executed based on the updated date information.
FIXED-IN: 5.0.9

(cherry picked from commit fdb3b3ba1b47ca8345c04fd24a79af6ee9c8cdd0)

M  +1    -0    kmymoney/dialogs/keditscheduledlg.cpp

https://invent.kde.org/office/kmymoney/commit/7d54d8f0c96e11a9d36545fa3ee1a89b1eb3c3bb