From 9efd0eef24a76df13b6374ade246a1021cf8e329 Mon Sep 17 00:00:00 2001 From: younes Date: Tue, 3 Jun 2025 12:22:36 +0100 Subject: [PATCH] Display first and second shift attendance information in the app via API. --- .../odex_mobile/controllers/rest_api_v2/attendance.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/odex25_mobile/odex_mobile/controllers/rest_api_v2/attendance.py b/odex25_mobile/odex_mobile/controllers/rest_api_v2/attendance.py index 2b0f1ce42..5977c981b 100644 --- a/odex25_mobile/odex_mobile/controllers/rest_api_v2/attendance.py +++ b/odex25_mobile/odex_mobile/controllers/rest_api_v2/attendance.py @@ -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),