Merge pull request #2377 from expsa/dev_odex25_mobile
Dev odex25 mobile
This commit is contained in:
commit
77b7badf97
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue