Skip to content

[MIG] hr_timesheet_attendance_ux: Migration to 20.0 - #76

Open
les-adhoc wants to merge 8 commits into
ingadhoc:20.0from
adhoc-dev:20.0-t-76492-les
Open

les-adhoc wants to merge 8 commits into
ingadhoc:20.0from
adhoc-dev:20.0-t-76492-les

Conversation

@les-adhoc

@les-adhoc les-adhoc commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Task: https://www.adhoc.inc/odoo/project.task/76492

Migration of hr_timesheet_attendance_ux from 19.0 to 20.0.

What changes

  • Migration (odoo-module-migrator + upgrade_code of Odoo 20.0, which changed nothing): version 20.0.1.0.0, installable: True.
  • Adopt the native "My Attendances" of 20.0 (product owner decision): remove the "My Attendances" and "Check In / Check Out" menus, their action, the list view with "Service Hours" (current_worked_hours) and the context override on hr_attendance.hr_attendance_action. The -u of hr_attendance puts the core context back.
  • Hours suggestion on a timesheet: the attended time now subtracts the new break_duration of 20.0. Open attendances still count up to now. The day is cut in the user's timezone, as in 19.0.
  • Task domain: add ('has_template_ancestor', '=', False), which the native domain has since 19.0 and the module lost when it replaced it. Template tasks are not offered any more.
  • [FIX] Time off task: the module replaced the domain of project_timesheet_holidays too, so the time off task was offered and saving a timesheet on it raised a UserError (already in 19.0). The domain is now built by a method that adds ('is_timeoff_task', '=', False) when that module is installed.
  • [FIX] Task domain and company: drop ('company_id', '=', company_id), like the native domain, so tasks of projects without company are offered (already in 19.0).
  • My Timesheet / Attendance pivot: drop search_default_user_id, the report has no user_id field.
  • My Timesheet / Attendance pivot access (product owner decision): in 20.0 the report is readable only by timesheet managers. Timesheet users get read access to their own lines again (security/ir.access.csv, same domain as the 19.0 user rule). Approvers and managers get it through their implied groups.
  • Refused attendances (product owner decision): the hours suggestion leaves out refused attendances (state is new in 20.0). The native report behind the pivot still counts them.
  • README and es.po updated. The module description (the README) is left untranslated.

depends and auto_install do not change. The license stays AGPL-3 (no Enterprise dependency).

Tests

The module had no tests in 19.0, so this is migrated without a regression net. Three new tests for the 20.0 code:

  • hours suggestion: break, time already logged, refused attendance, open attendance;
  • task domain: folded stage, template task, project without company, time off task (when project_timesheet_holidays is installed);
  • attendance report access: a timesheet user reads only their own lines.

Each one was seen failing by breaking the code on purpose. Run locally on a 20.0 database with project_timesheet_holidays: 0 failed, 0 error(s) of 3 tests (the first two were also run without it).

Data migration

No script needed: the only field removed (current_worked_hours) is computed and not stored; the menus, action and view are removed by the -u.

Not tested on a real upgraded database: runbot does not run the 19.0 → 20.0 upgrade yet.

@roboadhoc

Copy link
Copy Markdown
Contributor

Pull request status dashboard

@les-adhoc les-adhoc changed the title [WIP] [MIG] hr_timesheet_attendance_ux: Migration to 20.0 [MIG] hr_timesheet_attendance_ux: Migration to 20.0 Nov 11, 2026
Odoo 20.0 adds its own "My Attendances" in the Attendances app, so the
module drops its copy, as the product owner decided:

- remove the "My Attendances" and "Check In / Check Out" menus, their
  action and the list view with "Service Hours" (current_worked_hours)
- remove the context override on hr_attendance.hr_attendance_action: it
  asked for search_default_my_attendances, a filter that does not exist
  (it is called myattendances), and it replaced the whole core context,
  so the default grouping of the core was lost. The -u of hr_attendance
  puts the core context back
- hours suggestion on a timesheet: compute the attended time inline and
  subtract the new break_duration of 20.0
- task domain: add ('has_template_ancestor', '=', False). The native
  domain has it since 19.0 and the module lost it when it replaced the
  domain, so template tasks were offered
- My Timesheet / Attendance pivot: drop search_default_user_id, the
  report has no user_id field
…imesheets

The module replaces the task_id domain, and with it the condition
('is_timeoff_task', '=', False) that project_timesheet_holidays adds
(auto installed with hr_timesheet and hr_holidays). The module loads
after it, so the time off task was offered, and saving a timesheet on
it raised a UserError. Already the case in 19.0.

The domain is now built by a method, which adds the condition only when
project_timesheet_holidays is installed.
…pany

The task domain had ('company_id', '=', company_id), so a timesheet did
not offer the tasks of a project without company, which is valid. The
native domain has no company condition (and task_id has no
check_company), so the module now follows it. Already the case in 19.0.
…ttendances

Product owner decisions for the migration to 20.0:

- In 20.0 hr.timesheet.attendance.report is readable only by timesheet
  managers, so the "My Timesheet / Attendance" pivot disappeared for
  timesheet users and approvers. Give timesheet users read access to their
  own lines again, with the domain of the 19.0 user rule
  ([('employee_id', '=', user.employee_id.id)]). Approvers and managers
  get it through their implied groups.
- Attendances have a state in 20.0. The hours suggestion of a timesheet
  leaves the refused ones out, as the core does for the time rules.

Tests cover both, and each one was seen failing with the change undone.
README and translation terms updated.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants