[FIX] website_hr_recruitment: allow portal users to filter by department

Currently, only a public user or an internal user can access HR
department information. This is causing an access rights error when
trying to filter job offers on the website if connected with a portal
user, while there is no error if not connected (public user). We should
have the same behavior for the two cases.

closes odoo/odoo#92003

X-original-commit: 689a3aa9bf08bf3567c0fa0cc4cf67cc3d7e0b54
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Alex Thuyls (alt) <alt@odoo.com>
This commit is contained in:
alt-odoo
2022-05-21 12:10:11 +02:00
parent aa468fe0b6
commit e7ebb669db
2 changed files with 15 additions and 0 deletions
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import hr_department
from . import hr_recruitment
from . import website
@@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
class Department(models.Model):
_inherit = 'hr.department'
def name_get(self):
# Get department name using superuser, because model is not accessible
# for portal users
self_sudo = self.sudo()
return super(Department, self_sudo).name_get()