24 lines
1.6 KiB
ReStructuredText
24 lines
1.6 KiB
ReStructuredText
``hr_timesheet_sheet`` works on every analytic line of a period at once, while
|
|
``project_timesheet_holidays`` protects the analytic lines it generates for validated
|
|
time off against any modification or deletion. Together they make any timesheet sheet
|
|
that spans a day with validated time off unmanageable: opening, recomputing, creating or
|
|
saving such a sheet raises a ``UserError`` and the employee cannot record their hours.
|
|
|
|
This bridge module makes time off lines inert with respect to the bulk operations of the
|
|
sheet while keeping them visible inside it, so that the week is shown complete with its
|
|
time off hours included. Two different code paths are involved and both are handled: the
|
|
bulk ``write`` that links or unlinks ``sheet_id``, and the ``Command.DELETE`` the web
|
|
client emits for the lines that leave the set cached by the onchange, which ends up in a
|
|
real ``unlink()``. In the second case the time off line is detached from the sheet
|
|
(``sheet_id = False``) instead of being deleted; the time off request and the employee
|
|
balance are never touched.
|
|
|
|
The protection itself is not relaxed: the hours, date, project, task, employee and
|
|
description of a time off line still cannot be changed from a timesheet sheet, the line
|
|
still cannot be deleted by hand and new timesheets still cannot be created on a time off
|
|
task. Only a write that touches nothing but the neutral link fields is let through.
|
|
|
|
The module also closes a pre-existing hole in ``hr_timesheet_sheet``, whose
|
|
``_check_can_update_timesheet()`` returned ``True`` for any recordset without
|
|
``sheet_id`` and therefore silently disabled the core protection for every time off line
|
|
not linked to a sheet.
|