Skip to Content
Menu
This question has been flagged
1 Reply
2239 Views

Where to enter employee overtime entry in payroll ?


Avatar
Discard
Best Answer

Hello Sugumar,

To determine the hourly wage for a contract, divide the contract's wage by 30 and the number of hours per day in the contract's resource calendar.

contract.wage/30/contract.resource_calendar_id.hours_per_day


To calculate the total overtime worked by an employee, use the "employee.total_overtime" field.

If you want to calculate overtime pay for a specific pay period, you can use the following code:

  • Start with a variable "overtime" set to 0.
  • Loop through each overtime record for the employee using "employee.overtime_ids".
  • If the date of the overtime record falls within the date range of the payslip, add the duration of the overtime to the "overtime" variable.
  • Calculate the overtime pay by multiplying the "overtime" variable with the hourly rate calculated earlier.

Here is the source:

overtime = 0
for line in employee.overtime_ids:
​if payslip.date_from <= line.date <= payslip.date_to:
​overtime+= line.duration
result = (contract.wage/30/contract.resource_calendar_id.hours_per_day)*(overtime)

I hope this information is helpful to you.

Avatar
Discard