hr icon indicating copy to clipboard operation
hr copied to clipboard

[18.0] hr_employee_relative: access error when opening an employee when using a user that is not HR manager

Open jeromeguerriat-msf opened this issue 9 months ago • 1 comments

When opening the form view of an employee that has at least one relative, if the logged in user is not member of the group hr.group_hr_manager, it results in an access error

Module: hr_employee_relative

Affected versions: 18.0 at least.

Steps to reproduce the behavior: from an empty database:

  • create a user that is NOT an HR manager
  • create an employee for that user (button "create employee" on the user's form view for example)
  • on the created employee, add a relative (make sure to set its birthdate!)
  • save the relative
  • now, log in as that user
  • go to the your own employee's form view

basically, opening the form view of any employee will result in an access error if your user is not an HR Manager. This is because the compute method assign values to the fields "age_month" and "age_day", but those fields are not annoted with a compute method. Therefore, it tries to use write() which result in an access error (since the user has no "write" access rules)

Expected behavior no access error when opening the view

jeromeguerriat-msf avatar Apr 10 '25 11:04 jeromeguerriat-msf

Closed by mistake. This can be fixed with my PR: https://github.com/OCA/hr/pull/1458

jeromeguerriat-msf avatar Apr 10 '25 12:04 jeromeguerriat-msf

PR was merged, closing this issue

jeromeguerriat-msf avatar Apr 25 '25 14:04 jeromeguerriat-msf