commit
4a591e7137
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -84,9 +84,9 @@
|
|||
<h3>Attendance</h3>
|
||||
<p class="last-checkin-section"/>
|
||||
<p class="attendance-img-section"/>
|
||||
<p class="attendance-button-section">
|
||||
<!--p class="attendance-button-section">
|
||||
<button type="button" id="check_button" class="btn btn-danger"></button>
|
||||
</p>
|
||||
</p-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue