Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1340 Näkymät

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
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
2
heinäk. 25
3408
1
heinäk. 25
2587
0
jouluk. 23
1205
0
syysk. 20
1557
1
maalisk. 20
3801