[17.0][FIX] hr_timesheet_sheet: prevent deletion of timesheet entries when changing sheet period#848
Conversation
4164e52 to
27caac4
Compare
… when changing sheet period Changing a timesheet sheet’s period triggered a recomputation that removed lines whose dates fall outside the new range. This caused data loss, since existing timesheet entries were deleted instead of simply being detached from the sheet. refs OCA#847
27caac4 to
002a56c
Compare
rebased |
|
Thanks. Tested. There is an "issue" with this approach, that is, you need first to save the sheet before starting adding sheet lines or analytic lines. If not, it can lead to confusion, when you add the first sheet line, and then other sheet lines (for example time-offs) instantly appear. If you want to go with the approach of this PR, then my vote is to make invisible the "Select Project" button and the Details tab when the sheet is not saved yet. And also a little message "Please save the sheet before proceeding." instead of "Nothing to display." in the Summary tab when the sheet has not been saved yet. Otherwise, I still prefer #860, which simply solves the issue (deleting timesheets). |
alexey-pelykh
left a comment
There was a problem hiding this comment.
Thanks for this. Moving timesheet linkage from _onchange_scope into create() is the right call -- onchange-based data manipulation is unreliable for server-side operations. The test simplifications removing the Form-based timesheet assignment workarounds are a welcome cleanup. LGTM
When creating a new Timesheet Sheet, changing the period will trigger the method _onchange_scope() which calls _compute_timesheet_ids() that at every execution sets the timesheets : Delete the existing ones and Link new timesheets.
After that timesheets will be removed from the project too.
Issue Ref #847