Merge remote-tracking branch 'origin/dev_odex25_mobile' into dev_odex25_mobile

This commit is contained in:
Bakry 2024-08-14 16:51:46 +03:00
commit 8824fb4a2d
1 changed files with 41 additions and 13 deletions

View File

@ -52,6 +52,7 @@ class LeaveController(http.Controller):
'issuing_deliver_custdy': hol.issuing_deliver_custdy,
'permission_request_for': hol.permission_request_for,
'issuing_exit_return': hol.issuing_exit_return,
# 'exit_return_duration': hol.number_of_days_temp,
'exit_return_duration': hol.exit_return_duration,
'ticket_cash_request_type_id': hol.ticket_cash_request_type.id if hol.ticket_cash_request_type else False,
'ticket_cash_request_type_name': hol.ticket_cash_request_type.name if hol.ticket_cash_request_type else False,
@ -134,8 +135,15 @@ class LeaveController(http.Controller):
li = []
if balance:
for s in balance:
value = {'id': s.id, 'name': s.holiday_status_id.name or "", 'total': s.leave_balance,
'remain': s.remaining_leaves, 'taken': s.leaves_taken, }
value = {
"id": s.id,
"name": s.holiday_status_id.name or "",
# "total": s.leave_balance,
# "remain": s.remaining_leaves,
"remain": s.leave_balance,
"total": s.remaining_leaves,
"taken": s.leaves_taken,
}
li.append(value)
leaves = []
if holidays:
@ -220,12 +228,15 @@ class LeaveController(http.Controller):
"You Have issue in your employee profile. please check with one of your team admins"), success=False)
try:
with request.env.cr.savepoint():
vals = {'employee_id': employee.id, 'date_from': body['start_date'], 'date_to': body['end_date']
, 'name': body['description'] if body.get('description') else '',
'holiday_status_id': int(body['type_id']),
'delegate_acc': body['delegated_permission'],
# 'replace_by': int(body['replacement_id']) if body['replacement_id'] else False
}
vals = {
"employee_id": employee.id,
"date_from": body["start_date"],
"date_to": body["end_date"],
"name": body["description"] if body.get("description") else "",
"holiday_status_id": int(body["type_id"]),
"delegate_acc": body["delegated_permission"],
# 'replace_by': int(body['replacement_id']) if body['replacement_id'] else False
}
if 'ticket' in body and body['ticket']:
vals.update({'issuing_clearance_form': body['issuing_clearance_form'],
'issuing_deliver_custdy': body[
@ -252,9 +263,14 @@ class LeaveController(http.Controller):
})
holidays.attach_ids = [(4,attach.id)]
if holidays:
holidays._onchange_employee()
holidays._onchange_date_from()
holidays._onchange_date_to()
holidays._get_end_date()
holidays._get_holiday_related_date()
# holidays.confirm()
holidays.number_of_days_temp = holidays._get_number_of_days(body['start_date'], body['end_date'],
employee)
# holidays.number_of_days_temp = holidays._get_number_of_days(body['start_date'], body['end_date'],
# employee)
data = self.get_return_data(holidays)
return http_helper.response(message=_("Leave Created Successfully"), data={'leaves': [data]})
except (UserError, AccessError, ValidationError, Exception, Warning) as e:
@ -328,7 +344,12 @@ class LeaveController(http.Controller):
'res_id': holidays.id,
'att_holiday_ids': holidays.id,
})
holidays.attach_ids = [(4,attach.id)]
holidays.attach_ids = [(4, attach.id)]
holidays._onchange_employee()
holidays._onchange_date_from()
holidays._onchange_date_to()
holidays._get_end_date()
holidays._get_holiday_related_date()
data = self.get_return_data(holidays, approvel)
return http_helper.response(message=_("Leave Updated Successfully"), data={'leaves': [data]})
else:
@ -407,8 +428,15 @@ class LeaveController(http.Controller):
li = []
if balance:
for s in balance:
value = {'id': s.id, 'name': s.name or "", 'total': s.leave_balance,
'remain': s.remaining_leaves, 'taken': s.leaves_taken, }
value = {
"id": s.id,
"name": s.name or "",
# "total": s.leave_balance, repacel this in new relase
# "remain": s.remaining_leaves, repacel this in new relase
"remain": s.leave_balance,
"total": s.remaining_leaves,
"taken": s.leaves_taken,
}
li.append(value)
data = {'system_leaves': li, }
return http_helper.response(message="Data Found", data=data)