fix leave

This commit is contained in:
odex 2024-07-15 14:44:30 +03:00
parent 96e071f7a1
commit b8ab6f6a1d
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)