feature/odoo18 #2
|
|
@ -54,7 +54,7 @@ class HrEmployeeBase(models.Model):
|
|||
attendance_obj = self.env['hr.attendance']
|
||||
|
||||
# Check if there is an existing attendance record with no checkout
|
||||
attendance = attendance_obj.search([
|
||||
attendance = attendance_obj.sudo().search([
|
||||
('employee_id', '=', employee.id),
|
||||
('check_out', '=', False)
|
||||
], limit=1)
|
||||
|
|
@ -62,7 +62,7 @@ class HrEmployeeBase(models.Model):
|
|||
if not is_check_in:
|
||||
# If it's check-in, create a new attendance record
|
||||
if not attendance:
|
||||
record = attendance_obj.create({
|
||||
record = attendance_obj.sudo().create({
|
||||
'employee_id': employee.id,
|
||||
'check_in': fields.Datetime.now(),
|
||||
'in_latitude': latitude if latitude and latitude!=0 else False,
|
||||
|
|
@ -83,7 +83,7 @@ class HrEmployeeBase(models.Model):
|
|||
else:
|
||||
# If it's check-out, update the existing attendance record
|
||||
if attendance:
|
||||
attendance.write({
|
||||
attendance.sudo().write({
|
||||
'check_out': fields.Datetime.now(),
|
||||
'out_latitude': latitude if latitude and latitude != 0 else False,
|
||||
'out_longitude': longitude if longitude and longitude != 0 else False,
|
||||
|
|
|
|||
Loading…
Reference in New Issue