Merge pull request #3910 from expsa/you_dev_odex25_mobile

Fix bug
This commit is contained in:
kchyounes19 2025-07-15 08:53:39 +01:00 committed by GitHub
commit 12b61d5e4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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: