This commit is contained in:
younes 2025-07-15 08:52:34 +01:00
parent e20d4d3fe2
commit d958040137
1 changed files with 7 additions and 6 deletions

View File

@ -339,7 +339,8 @@ class LeaveController(http.Controller):
with request.env.cr.savepoint():
holidays = http.request.env['hr.holidays'].search([('id', '=', int(id))])
if holidays:
days = holidays._get_number_of_days(body['start_date'], body['end_date'], employee)
days = holidays._get_number_of_days(body['start_date'], body['end_date'], employee.id,holidays.holiday_status_id.official_holidays,
holidays.holiday_status_id.working_days)
local_tz = pytz.timezone(
user.tz or 'GMT')
from_date = fields.Datetime.from_string(body["start_date"]).replace(hour=0, minute=0, second=0,
@ -389,11 +390,11 @@ class LeaveController(http.Controller):
'att_holiday_ids': holidays.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()
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: