Merge pull request #3414 from expsa/dev_odex25_mobile

Dev odex25 mobile
This commit is contained in:
kchyounes19 2025-06-03 12:24:48 +01:00 committed by GitHub
commit fb51d46d3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -260,6 +260,9 @@ class AttendanceController(http.Controller):
return http_helper.response(code=400, message=_("You are not allowed to perform this operation. please check with one of your team admins"), success=False)
if not body.get('date'):
return http_helper.response(code=400, message=_("Enter Date First"), success=False)
sequence = 1
if body.get('sequence'):
sequence = int(body.get('sequence'))
employee = http.request.env['hr.employee'].search([('user_id', '=', user.id)], limit=1)
if not employee:
return http_helper.response(code=400, message=_("You are not allowed to perform this operation. please check with one of your team admins"), success=False)
@ -274,7 +277,7 @@ class AttendanceController(http.Controller):
month_end = now
try:
records = http.request.env['hr.attendance.transaction'].sudo().search([('employee_id', '=', employee.id),
('date', '>=', str(month_start)), ('date', '<=', str(month_end)),('sequence','=',1)])
('date', '>=', str(month_start)), ('date', '<=', str(month_end)),('sequence','=',sequence)])
# records = http.request.env['hr.attendance.transaction'].search([('employee_id','=',employee.id),
# ('normal_leave', '=', True),('public_holiday', '=', True), ('is_absent','=',True),('date', '>=', str(month_start)), ('date', '<=', str(month_end))])
li = []
@ -314,6 +317,7 @@ class AttendanceController(http.Controller):
for rec in records:
attendance = {
'id':rec.id,
'sequence':rec.sequence,
'date':str(rec.date),
'tr_date':self.get_translation_field(rec, 'date'),
'first_check_in':self.convert_float_2time(rec.sign_in),