make JSON selection
This commit is contained in:
parent
6fe158154f
commit
2a20788548
|
|
@ -39,13 +39,11 @@ class PermissionController(http.Controller):
|
||||||
try:
|
try:
|
||||||
permissions = False
|
permissions = False
|
||||||
permission_types = http.request.env['hr.personal.permission.type'].search_read([], ['name'])
|
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_field = http.request.env['hr.personal.permission']._fields['type_exit']
|
||||||
# type_exit_opts = [
|
type_exit_opts = [
|
||||||
# {"value": key, "label": str(http.request.env['ir.qweb'].env._(label))}
|
{"value": key, "label": _(label)}
|
||||||
# for key, label in type_exit.selection
|
for key, label in type_exit_field.selection
|
||||||
# ]
|
]
|
||||||
type_exit_opts = dict(http.request.env['hr.personal.permission']._fields['type_exit']._description_selection(http.request.env))
|
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
emp = []
|
emp = []
|
||||||
if approvel:
|
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'):
|
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"),
|
return http_helper.response(code=400, message=_("Enter All required Dates for Permission request"),
|
||||||
success=False)
|
success=False)
|
||||||
|
|
||||||
if not body.get('early_exit'):
|
if not body.get('early_exit'):
|
||||||
return http_helper.response(code=400, message="Enter Early Exit for Permission request", success=False)
|
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'):
|
# if not body.get('mission_purpose'):
|
||||||
# return http_helper.response(code=400, message="mission purpose for Permission request", success=False)
|
# 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)
|
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"],
|
"mission_purpose": body["mission_purpose"],
|
||||||
"permission_number": permission_number,
|
"permission_number": permission_number,
|
||||||
"date": body["date"],
|
"date": body["date"],
|
||||||
"type_exit":body["type_exit"]
|
"type_exit":type_exit_val
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue