diff --git a/yuthon_hr_attendance/controllers/portal.py b/yuthon_hr_attendance/controllers/portal.py index 7cf40516f..f595bfe2c 100644 --- a/yuthon_hr_attendance/controllers/portal.py +++ b/yuthon_hr_attendance/controllers/portal.py @@ -53,8 +53,10 @@ class CustomerPortal(portal.CustomerPortal): @http.route('/phone/vacation/self', type='http', auth="none", csrf=False, cors='*') def phone_vacation_self(self, **kw): - emp_id = request.env['res.users'].sudo().search([('id', '=', int(kw.get('users_id')))]) - records = request.env['yuthon.vacation.reports'].sudo().search([('employee_id.id', '=', emp_id.employee_id.id)]) + users_id = int(kw.get('users_id')) + user = request.env['res.users'].sudo().browse(int(users_id)) + employee_id = user.with_company(user.company_id.id).employee_id.id + records = request.env['yuthon.vacation.reports'].sudo().search([('employee_id.id', '=', employee_id)]) data = {} for record in records: year = record.vacation_date.year