Merge pull request #474 from expsa/bakry_base

Bakry base
This commit is contained in:
bakry 2024-08-01 17:38:15 +03:00 committed by GitHub
commit 4a591e7137
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -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>