Skip to content

[19.0][FIX] hr_employee_calendar_planning, hr_course: employees readable by internal users - #1671

Open
parabol123654 wants to merge 2 commits into
OCA:19.0from
parabol123654:19.0-fix-hr-employee-public-read
Open

parabol123654 wants to merge 2 commits into
OCA:19.0from
parabol123654:19.0-fix-hr-employee-public-read

Conversation

@parabol123654

@parabol123654 parabol123654 commented Nov 12, 2026 •

Copy link
Copy Markdown

Forward port of #1662 (18.0, merged) for the modules that exist on 19.0. hr_appraisal_oca is not migrated yet.

Users without HR rights read employees through hr.employee.public. Fields added on hr.employee only, without groups, make a read of all the fields of an employee fail for them (read([]), search_read without fields):

AccessError: The fields “count_courses,courses_ids,calendar_ids,stored_is_flexible”, which you are trying to read, are not available for employee public profiles.

The fix adds groups="hr.group_hr_user" to these fields:

  • hr_employee_calendar_planning: calendar_ids, as on 18.0. On 19.0 also stored_is_flexible (on hr.version, so it is inherited by hr.employee), the stored copy of core is_flexible, which has the same group.
  • hr_course: count_courses and courses_ids.

Test: test_read_employees_internal_user (from #1662). An internal user creates its employee and reads it with all fields.

  • Without the fix: the AccessError above, and core hr TestSelfAccessProfile.test_employee_fields_groups fails too.
  • With the fix: both pass. The tests of both modules and the core test pass (22 tests, without demo data as in the CI).

Assisted-by: Claude Opus 5.5

@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hi @victoralmau, @pedrobaeza,
some modules you are maintaining are being modified, check this out!

@OCA-git-bot OCA-git-bot added series:19.0 mod:hr_employee_calendar_planning Module hr_employee_calendar_planning mod:hr_course Module hr_course labels Nov 12, 2026
…sers

calendar_ids is defined on hr.employee only, without groups. Users
without HR rights read employees through hr.employee.public, so a read
of all the fields of an employee (read([]), search_read without fields,
e.g. from an API client) raised "The fields calendar_ids, which you are
trying to read, are not available for employee public profiles".

Restrict the field to HR officers, as core does for the fields that are
not on hr.employee.public.

Assisted-by: Claude Opus 5.5
count_courses and courses_ids are defined on hr.employee only, without
groups, so a read of all the fields of an employee by a user without HR
rights raised "The fields ..., which you are trying to read, are not
available for employee public profiles". Restrict them to HR officers.

Assisted-by: Claude Opus 5.5
@parabol123654
parabol123654 force-pushed the 19.0-fix-hr-employee-public-read branch from dd7cf80 to 408774e Compare November 14, 2026 18:46

@victoralmau victoralmau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add #1667 to avoid errors.

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

Labels

mod:hr_course Module hr_course mod:hr_employee_calendar_planning Module hr_employee_calendar_planning series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants