Tuesday, November 30, 2021
1 change
Code cleanup and technical improvements
This refactor simplifies how project task auto-shifting calculates employee availability and planned dates. It makes scheduling behavior more consistent by using the company calendar whenever an employee is unavailable or not covered by a valid work calendar, reducing module-specific custom logic.
Original PR description
Purpose ======= The auto-shift functionnality shifts the tasks backward or forward thanks to two triggers : - Manual trigger : User clicks on an arrow in the gantt view - Auto trigger : User plans a…
Purpose ======= The auto-shift functionnality shifts the tasks backward or forward thanks to two triggers : - Manual trigger : User clicks on an arrow in the gantt view - Auto trigger : User plans a task in conflict with a depending task that should be shifted in order to keep a waterfall order. This functionnality may be summarized as : 1) When a forward (resp. backward) shift is triggered, find the first datetime in the future (resp. the past) where the assignee is available. 2) Starting from this datetime, allocate the planned hours based on user's calendar availabilities. Analysis ======== Currently the implementation takes a big advantage of caching the work intervals information for a given calendar and resource and fill efficiently the dict in order to limit the number of calls to work_intervals_batch. However efficient, the current implementation can be factorized in order to have : 1) a unique method responsible of the work intervals caching which is handled two times currently. 2) a unique method responsible of giving the new begin and end planned dates, whatever there are or not planned hours on task 3) an efficient way to use the 'calendar validity' API of resource introduced in PR #21135. Which allows to remove overrides in project_enterprise_hr and project_enterprise_hr_contract. task-2643752