fix holiday
This commit is contained in:
parent
0da086450d
commit
9eefc082cd
|
|
@ -1622,20 +1622,21 @@ class HRHolidays(models.Model):
|
|||
"""chick a holiday take balance with years balance"""
|
||||
for item in self:
|
||||
holiday_days = item.number_of_days_temp
|
||||
holiday_type = item.holiday_status_id.leave_type
|
||||
employee_balance = self.env['hr.holidays'].search([('employee_id', '=', item.employee_id.id),
|
||||
('holiday_status_id', '=', item.holiday_status_id.id),
|
||||
('type', '=', 'add'),
|
||||
('check_allocation_view', '=', 'balance')],
|
||||
order='id desc', limit=1)
|
||||
leave_type = ['exam', 'marriage','parental','emergency','sick']
|
||||
if item.holiday_status_id.leave_type in leave_type:
|
||||
if holiday_type in leave_type:
|
||||
cron_run_date = item.employee_id.first_hiring_date
|
||||
holi_date_from = fields.Date.from_string(item.date_from)
|
||||
holi_date_to = fields.Date.from_string(item.date_to)
|
||||
if employee_balance.holiday_ids:
|
||||
cron_run_date = employee_balance.holiday_ids[-1].cron_run_date
|
||||
|
||||
if cron_run_date > holi_date_to:
|
||||
if (holiday_type=='sick' and cron_run_date > holi_date_to) or (cron_run_date.year > holi_date_to.year):
|
||||
holiday_days = 0
|
||||
if holi_date_to >= cron_run_date > holi_date_from:
|
||||
holiday_days = (holi_date_to - cron_run_date).days+1
|
||||
|
|
|
|||
Loading…
Reference in New Issue