Skip to Content
Menú
This question has been flagged
1455 Vistes

I was attempting to calculate a payslip and add a salary rule that multiplies overtime hours by 2.5 if an employee worked on a holiday. However, I couldn't determine whether a specific work date falls on a holiday. Is there a way to check if a given date is a holiday? Also, how can I work with datetime to handle this?

# gpt suggested this 
def is_holiday():
    today = payslip.date_from.date() 
    holidays = payslip.env['resource.calendar.leaves'].search([
        ('date_from', '<=', today),
        ('date_to', '>=', today)
    ])
    return bool(holidays)


Avatar
Descartar
Related Posts Respostes Vistes Activitat
2
de jul. 25
3571
1
de jul. 25
2717
0
de des. 23
1304
0
de set. 20
1557
1
de març 20
3917