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