fix some bug
This commit is contained in:
parent
e793c9ba12
commit
7d2493cbed
|
|
@ -243,10 +243,12 @@ class LeaveController(http.Controller):
|
|||
message = validator.get_server_error(e, user)
|
||||
return http_helper.errcode(code=403, message=message)
|
||||
|
||||
@http.route(['/rest_api/v2/leaves/<string:id>'], type='http', auth='none', csrf=False, methods=['PUT'])
|
||||
@http.route(['/rest_api/v2/leaves/<int:id>'], type='http', auth='none', csrf=False, methods=['PUT'])
|
||||
def edit_leaves(self, id, approvel=None, **kw):
|
||||
http_method, body, headers, token = http_helper.parse_request()
|
||||
result = validator.verify_token(token)
|
||||
# import pdb
|
||||
# pdb.set_trace()
|
||||
if not result['status']:
|
||||
return http_helper.errcode(code=result['code'], message=result['message'])
|
||||
user = validator.verify(token)
|
||||
|
|
@ -265,7 +267,10 @@ class LeaveController(http.Controller):
|
|||
"You Have issue in your employee profile. please check with one of your team admins"),
|
||||
success=False)
|
||||
try:
|
||||
holidays = http.request.env['hr.holidays'].search([('id', '=', id)])
|
||||
holidays = http.request.env['hr.holidays'].search([('id', '=', int(id))])
|
||||
print(holidays, id)
|
||||
|
||||
|
||||
if holidays:
|
||||
days = holidays._get_number_of_days(body['start_date'], body['end_date'], employee)
|
||||
vals = {
|
||||
|
|
@ -299,10 +304,18 @@ class LeaveController(http.Controller):
|
|||
'store_fname': body['attachment'].filename,
|
||||
'res_model': 'hr.holidays',
|
||||
'res_id': holidays.id,
|
||||
'att_holiday_ids': holidays.id,
|
||||
})
|
||||
print(attach)
|
||||
holidays.attach_ids = [(4,attach.id)]
|
||||
data = self.get_return_data(holidays, approvel)
|
||||
|
||||
return http_helper.response(message=_("Leave Updated Successfully"), data={'leaves': [data]})
|
||||
|
||||
else:
|
||||
return http_helper.response(code=400,
|
||||
message=_(
|
||||
"You Have issue in your employee profile. please check with one of your team admins"),
|
||||
success=False)
|
||||
except Exception as e:
|
||||
_logger.error(str(e))
|
||||
message = validator.get_server_error(e, user)
|
||||
|
|
|
|||
Loading…
Reference in New Issue