Merge pull request #4088 from expsa/fix_multi_db

make type exit
This commit is contained in:
mohammed-alkhazrji 2025-08-04 00:10:49 +03:00 committed by GitHub
commit 957ae7bff9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 1 deletions

View File

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