Merge pull request #2340 from expsa/samir-aladawi-force-quit-solution

[UPD] odex_mobile: possibility to create multiple sign in
This commit is contained in:
SamirLADOUI-sa 2025-02-10 10:19:06 +01:00 committed by GitHub
commit e995568c83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 31 additions and 31 deletions

View File

@ -202,38 +202,38 @@ class AttendanceController(http.Controller):
order='name desc',
limit=1)
system_checkout = json.loads(body.get('system_checkout')) if 'system_checkout' in body else False
if not rec or rec and rec.action != body.get('action'):
attendance = http.request.env['attendance.attendance'].create({
'employee_id':employee.id,
'action':body.get('action'),
'action_type':"system_checkout" if body.get('action') == 'sign_out' and system_checkout == True else 'application',
'name': fields.datetime.now(),
# 'device_id':body.get('device_id'),
'zone':zone.zone if zone else "%s,%s" % (body.get('longitude'), body.get('latitude')),
'longitude': body.get('longitude'),
'latitude':body.get('latitude'),
})
if attendance:
if body.get('action') == 'sign_out' and system_checkout == True:
msg = (_("System Force Sign out Due to Change Location Permission "))
subject = (_("System Force Sign out"))
self.send_msg(employee, msg, subject)
# if not rec or rec and rec.action != body.get('action'):
attendance = http.request.env['attendance.attendance'].create({
'employee_id':employee.id,
'action':body.get('action'),
'action_type':"system_checkout" if body.get('action') == 'sign_out' and system_checkout == True else 'application',
'name': fields.datetime.now(),
# 'device_id':body.get('device_id'),
'zone':zone.zone if zone else "%s,%s" % (body.get('longitude'), body.get('latitude')),
'longitude': body.get('longitude'),
'latitude':body.get('latitude'),
})
if attendance:
if body.get('action') == 'sign_out' and system_checkout == True:
msg = (_("System Force Sign out Due to Change Location Permission "))
subject = (_("System Force Sign out"))
self.send_msg(employee, msg, subject)
date = attendance.name.time()
data = {
"id": attendance.id,
"action": attendance.action,
"attendance_status": attendance.action,
"time": str(date),
"zone": attendance.zone,
"longitude": attendance.longitude,
"latitude": attendance.latitude,
"range": zone.allowed_range if zone else False,
}
msg = (_("Check Out successfully")) if body.get('action') == 'sign_out' else (_("Check in successfully"))
else:
msg = (_("Check Fail Due To Duplication"))
data = {}
date = attendance.name.time()
data = {
"id": attendance.id,
"action": attendance.action,
"attendance_status": attendance.action,
"time": str(date),
"zone": attendance.zone,
"longitude": attendance.longitude,
"latitude": attendance.latitude,
"range": zone.allowed_range if zone else False,
}
msg = (_("Check Out successfully")) if body.get('action') == 'sign_out' else (_("Check in successfully"))
# else:
# msg = (_("Check Fail Due To Duplication"))
# data = {}
# Reset last_active_time when the employee signed out
if body.get('action') == 'sign_out':
employee.last_active_time = False