add hr_timesheet_sheet_no_review, hr_timesheet_sheet_holidays, hr_timesheet_sheet_delete_cascade

This commit is contained in:
Luis 2026-09-22 10:58:36 +02:00
parent b07082f70d
commit 8b0d0bb6cc
53 changed files with 3953 additions and 0 deletions

View file

@ -0,0 +1,3 @@
* Criptomart
* Luis Martín <luis@criptomart.net>

View file

@ -0,0 +1,20 @@
``hr_timesheet_sheet`` ships a review workflow: the employee submits the sheet,
a reviewer approves or refuses it and may send it back to draft. Many
organisations never use it — they record hours and do not submit them for
approval.
The workflow is not harmless when it is not used. ``_check_state()`` forbids
modifying the timesheet entries of any sheet that is not in ``new`` or
``draft``. A sheet submitted by mistake and never attended freezes its entries
forever: nobody can edit them, and ``action_timesheet_draft()`` only works from
``done``, never from ``confirm``.
This module removes the review workflow from the user interface — buttons,
kanban actions, search filters, the department counter of sheets to approve
and the menus that only exist to serve it — and adds a wizard that sends the
sheets that got stuck in ``confirm`` or ``done`` back to draft.
The ``action_timesheet_*`` methods of the base module are left untouched, so
the rest of the family (``hr_timesheet_sheet_attendance``,
``hr_timesheet_sheet_policy_*``, ``hr_timesheet_sheet_autodraft``) keeps
working. They simply no longer have an entry point in the interface.

View file

@ -0,0 +1,31 @@
Hiding the review workflow is not the same as forbidding it. The
``action_timesheet_*`` methods stay callable from code, from a server action or
from another module, so a sheet can still go back to ``confirm`` through a
non-interactive path. That is deliberate, for compatibility with the rest of the
family. An installation that needs to really forbid it would need a separate
module.
The modules of the family that take the review workflow for granted lose their
purpose with this one installed. They do not break, because the methods are
still there, but they become unreachable from the user interface:
* ``hr_timesheet_sheet_policy_department_manager``
* ``hr_timesheet_sheet_policy_project_manager``
* ``hr_timesheet_sheet_autodraft``
* the ``action_timesheet_confirm`` check of ``hr_timesheet_sheet_attendance``
Unfreezing cannot be undone. Uninstalling the module brings the buttons back,
but the sheets that were already set back to draft stay in draft, and the four
menus of the review workflow stay deactivated: they belong to the base module
and Odoo does not restore a value written on a foreign record.
The ``Timesheets to Review`` action of the department kanban loses both of its
entry points, but the action record itself survives, because
``ir.actions.act_window`` has no ``active`` field to switch off. It is only
reachable from Settings > Technical > Actions, and its stale
``search_default_to_review`` context key no longer matches any filter.
With the sheets back in ``draft``, every save triggers the base module's
``delete_empty_lines(True)``, which removes lines with no description and no
hours. This is pre-existing behaviour, but it may prune historical empty
entries the first time those sheets are opened.

View file

@ -0,0 +1,22 @@
Once installed, the review buttons are gone from the timesheet sheet form and
kanban; the ``Submitted``, ``To Review`` and ``Reviewer`` entries are gone from
the sheet search view; the ``Not Submitted`` filter is gone from the timesheet
search view; the department kanban no longer counts the sheets to approve; and
the ``To Review`` and ``Timesheets to Submit`` menus are deactivated.
To release the sheets that were left frozen by the review workflow, go to
*Timesheets > Timesheets > Unfreeze Pending Sheets*. The wizard first shows how
many sheets, how many timesheet entries and how many hours are about to be
released. Confirming sets those sheets back to draft and clears their reviewer.
Installing the module never changes the state of a sheet on its own: unfreezing
is always an explicit decision of the timesheet manager. Running the wizard
twice is safe — the second run reports zero sheets and changes nothing.
Take a backup before the first run: the operation touches every frozen sheet at
once and the reviewer of the approved ones is lost.
To decide which sheets count as frozen, override
``hr_timesheet.sheet._unfreeze_domain()``. For instance, an installation that
wants to keep its approved sheets as historical record can narrow it down to
``[("state", "=", "confirm")]``.