fix
This commit is contained in:
parent
21159924ed
commit
5c6fe53210
|
|
@ -438,16 +438,20 @@ class SystemDashboard(models.Model):
|
|||
}
|
||||
return attendance_date
|
||||
else:
|
||||
|
||||
result = attendance.create(vals_in)
|
||||
# check whether last action sign in or out and its date
|
||||
attendance = self.env['attendance.attendance'].sudo().search(
|
||||
[('employee_id', '=', employee_object.id), ('action_date', '=', t_date)])
|
||||
user_tz = pytz.timezone(self.env.context.get('tz', 'Asia/Riyadh') or self.env.user.tz) #add
|
||||
time_object = fields.Datetime.from_string(attendance[-1].name) #add
|
||||
time_in_timezone = pytz.utc.localize(time_object).astimezone(user_tz) #add
|
||||
is_attendance = True
|
||||
if not attendance:
|
||||
is_attendance = False
|
||||
if attendance and attendance[-1].action == 'sign_out':
|
||||
is_attendance = False
|
||||
attendance_date = {'is_attendance': is_attendance,
|
||||
'time': attendance[-1].name if attendance else False
|
||||
'time': time_in_timezone if attendance else False
|
||||
}
|
||||
return attendance_date
|
||||
|
|
|
|||
Loading…
Reference in New Issue