Merge pull request #1642 from expsa/samir-aladawi-fix-employee-access

[FIX] odex_mobile: employee access
This commit is contained in:
SamirLADOUI-sa 2024-10-28 13:25:41 +01:00 committed by GitHub
commit 6ba2b60100
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -186,7 +186,7 @@ class AttendanceController(http.Controller):
return http_helper.response(code=400, message=_("Enter Device Id"), success=False)
if not body.get('latitude') or not body.get('longitude'):
return http_helper.response(code=400, message=_("Enter Zone Data for Check in"), success=False)
employee = http.request.env['hr.employee'].search([('user_id', '=', user.id)], limit=1)
employee = http.request.env['hr.employee'].sudo().search([('user_id', '=', user.id)], limit=1)
if not employee:
return http_helper.response(code=400, message=_("You are not allowed to perform this operation. please check with one of your team admins"), success=False)
if employee.device_id != body.get('device_id'):
@ -503,7 +503,7 @@ class AttendanceController(http.Controller):
)
# Find employee linked to the user
employee = request.env['hr.employee'].search([('user_id', '=', user.id)], limit=1)
employee = request.env['hr.employee'].sudo().search([('user_id', '=', user.id)], limit=1)
if not employee:
return http_helper.response(
code=400,