make JSON selection
This commit is contained in:
parent
6fe158154f
commit
2a20788548
|
|
@ -39,13 +39,11 @@ 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
|
||||
# ]
|
||||
type_exit_opts = dict(http.request.env['hr.personal.permission']._fields['type_exit']._description_selection(http.request.env))
|
||||
|
||||
type_exit_field = http.request.env['hr.personal.permission']._fields['type_exit']
|
||||
type_exit_opts = [
|
||||
{"value": key, "label": _(label)}
|
||||
for key, label in type_exit_field.selection
|
||||
]
|
||||
count = 0
|
||||
emp = []
|
||||
if approvel:
|
||||
|
|
@ -121,8 +119,10 @@ class PermissionController(http.Controller):
|
|||
if not body.get('date') or not body.get('date_from') or not body.get('date_to') or not body.get('permission_type_id'):
|
||||
return http_helper.response(code=400, message=_("Enter All required Dates for Permission request"),
|
||||
success=False)
|
||||
|
||||
if not body.get('early_exit'):
|
||||
return http_helper.response(code=400, message="Enter Early Exit for Permission request", success=False)
|
||||
type_exit_val = body.get("type_exit") or "early_exit"
|
||||
# if not body.get('mission_purpose'):
|
||||
# return http_helper.response(code=400, message="mission purpose for Permission request", success=False)
|
||||
employee = http.request.env['hr.employee'].search([('user_id', '=', user.id)], limit=1)
|
||||
|
|
@ -146,7 +146,7 @@ class PermissionController(http.Controller):
|
|||
"mission_purpose": body["mission_purpose"],
|
||||
"permission_number": permission_number,
|
||||
"date": body["date"],
|
||||
"type_exit":body["type_exit"]
|
||||
"type_exit":type_exit_val
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue