Merge pull request #707 from expsa/fix_api_web

[IMP] FIX CALA HOLDAYS DURATION
This commit is contained in:
AbuzarExp 2024-08-14 13:46:16 +03:00 committed by GitHub
commit 9eac95733e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 23 additions and 9 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,
@ -227,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[
@ -259,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:
@ -335,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: