diff --git a/odex25_mobile/odex_mobile/controllers/rest_api_v2/permission.py b/odex25_mobile/odex_mobile/controllers/rest_api_v2/permission.py index 0c179c9b7..3b19b7cbe 100644 --- a/odex25_mobile/odex_mobile/controllers/rest_api_v2/permission.py +++ b/odex25_mobile/odex_mobile/controllers/rest_api_v2/permission.py @@ -40,6 +40,12 @@ class PermissionController(http.Controller): try: permissions = False permission_types = http.request.env['hr.personal.permission.type'].search_read([], ['name']) + type_exit = http.request.env['hr.personal.permission']._fields['type_exit'] + type_exit_opts = [ + {"value": key, "label": str(http.request.env['ir.qweb'].env._(label))} + for key, label in type_exit.selection + ] + count = 0 emp = [] if approvel: @@ -72,6 +78,7 @@ class PermissionController(http.Controller): "reason_msg": per.reason or "", "mission_purpose": per.mission_purpose or "", "attachment": self.get_attchment(per), + "type_exit":per.type_exit } emp.append(value) @@ -87,7 +94,7 @@ class PermissionController(http.Controller): url = f"/rest_api/v2/permissions?page={next}&{'&'.join(params)}" if next else False prev_url = f"/rest_api/v2/permissions?page={prev}&{'&'.join(params)}" if prev else False data = {'links': {'prev': prev_url, 'next': url, }, 'count': count, - 'results': {'permission_types': permission_types, 'permissions': emp, 'groups': ['group_division_manager', 'group_hr_user']}} + 'results': {'permission_types': permission_types, 'type_exit':type_exit, 'permissions': emp, 'groups': ['group_division_manager', 'group_hr_user']}} return http_helper.response(message="Data Found", data=data) except (UserError, AccessError, ValidationError, Exception, Warning) as e: http.request._cr.rollback() @@ -139,6 +146,7 @@ class PermissionController(http.Controller): "mission_purpose": body["mission_purpose"], "permission_number": permission_number, "date": body["date"], + "type_exit":body["type_exit"] } ) @@ -169,6 +177,7 @@ class PermissionController(http.Controller): "reason_msg": permission.reason or "", "mission_purpose": permission.mission_purpose or "", "attachment": self.get_attchment(permission), + "type_exit":permission.type_exit } return http_helper.response(message="Permission Created Successfully", data={'permission': [data]}) except (UserError, AccessError, ValidationError, Exception, Warning) as e: