Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][IMP] hr_employee_age: Add groups="hr.group_hr_user" to age field according to birthday field definition #1270

Merged
merged 1 commit into from
Jul 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion hr_employee_age/models/hr_employee.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
class HrEmployee(models.Model):
_inherit = "hr.employee"

age = fields.Integer(compute="_compute_age")
# The age field uses a depends (birthday) that has defined
# groups="hr.group_hr_user", if a user without permissions in HR tries to get
# the value of this field will have an error.
# The correct way to avoid this inconsistency is to define groups to field age
age = fields.Integer(compute="_compute_age", groups="hr.group_hr_user")

@api.depends("birthday")
def _compute_age(self):
Expand Down