Merge pull request #204 from expsa/fix_api_web

fix leave
This commit is contained in:
AbuzarExp 2024-07-15 14:45:19 +03:00 committed by GitHub
commit 084fd4c199
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 6 deletions

View File

@ -120,11 +120,14 @@ class LeaveController(http.Controller):
hol_type = []
if status:
for s in status:
records = balance.filtered(
lambda r: r.holiday_status_id == s)
value = {'id': s.id, 'name': s.name or "", 'ticket': s.issuing_ticket,
'balance': records[0].remaining_leaves if records else 0,
'alternative_chick': s.alternative_chick}
records = balance.filtered(lambda r: r.holiday_status_id == s)
value = {
"id": s.id,
"name": s.with_context({"employee_id": employee.id}).name_get()[0][1] or "",
"ticket": s.issuing_ticket,
"balance": records[0].remaining_leaves if records else 0,
"alternative_chick": s.alternative_chick,
}
hol_type.append(value)
li = []
if balance:
@ -386,4 +389,4 @@ class LeaveController(http.Controller):
http.request._cr.rollback()
_logger.error(str(e))
message = validator.get_server_error(e, user)
return http_helper.errcode(code=403, message=message)
return http_helper.errcode(code=403, message=message)