Daily updates from Odoo
Friday, August 18, 2023
1 change · master
Resolved issues and error corrections
Fixes an issue where copying shifts from a previous week and then using auto planning could fail because empty unplanned shifts were removed during processing. The change ensures only valid shifts are considered and slightly improves how cleanup is handled, making planning more reliable for sales-linked work.
Original PR description
## [FIX] sale_planning: ensure shift unplanned has allocated_hours>0 Before this commit, when the user copies the shifts in the previous week and then auto plan, an error occurs because a record is…
## [FIX] sale_planning: ensure shift unplanned has allocated_hours>0 Before this commit, when the user copies the shifts in the previous week and then auto plan, an error occurs because a record is used but it does no longer exist in the database. The reason is the shift unplanned will be used in the auto plan feature to plan it to an available resource but the problem is that shift has allocated_hours equals to 0 and so it is removed in the process since it means we have no longer something to plan for a specific SOL. This commit recomputes the `planning_hours_planned` to be sure the post_process, called in the create method, remove the shifts unplanned with allocated hours equals to 0. ## [IMP] sale_planning: avoid browsing for each element found in the loop Before this commit, we search the unplanned shifts to remove (the ones with `allocated_hours == 0`) and each time we found a shift, we add it in a recordset by using the union operator. This commit improves that part of code by using the filtered method to only do one browse at the end of the function instead of doing a browse for each union operator done.