ODOO FLUTTER

This commit is contained in:
Pranay 2025-05-09 14:38:55 +05:30 committed by raman
parent 1424e147e8
commit 6cb1d7526e
1 changed files with 3 additions and 3 deletions

View File

@ -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,