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

Hello Odoo Community,
I appreciate your support with the following case , 

I am currently implementing Odoo Enterprise version 17 in a factory , and  seeking your expertise to help me configure the system for the following requirements. Noting that the factory uses biometric devices to track employees and workers attendance so I need to choose the attendance app as the work entry source on employees and workers' related contracts settings to be able to create accurate pay slips.

The factory operates with two shifts from Saturday to Thursday:

1. First Shift:

  • Time: 8:00 AM to 4:00 PM
  • Overtime: Workers have the option to work overtime from 4:00 PM to 8:00 PM.

2. Second Shift:

  • Time: 8:00 PM to 4:00 AM (next day)
  • Overtime: Workers can work overtime from 4:00 AM to 8:00 AM.

I tried Odoo planning module to setup the needed shifts with appropriate settings , but I couldn't manage to get it work correctly. 

I appreciate if you could help.

Avatar
Discard
Best Answer

To configure shifts spanning two days in Odoo Enterprise version 17 for your factory workers and staff, you need to leverage the Attendance, Planning, and Payroll modules effectively. Below are step-by-step instructions to set up your required scenario:

1. Configure Shifts in the Planning Module

The Planning module helps create and manage shifts that span across multiple days.

Steps to Configure Shifts:

  1. Enable Planning Module:
    • Go to Apps and install the Planning module.
    • Navigate to Planning > Configuration > Planning Settings.
    • Ensure Enable Planning by Employees is active.
  2. Create Shift Templates:
    • Navigate to Planning > Configuration > Shift Templates.
    • Create two templates:
      • First Shift:
        • Start Time: 8:00 AM
        • End Time: 4:00 PM
      • Second Shift:
        • Start Time: 8:00 PM
        • End Time: 4:00 AM (next day).
  3. Assign Shifts to Employees:
    • Go to Planning > Planning.
    • Select employees and assign them to the First Shift or Second Shift based on their schedule.
    • Use the repeat functionality to schedule shifts weekly (Saturday to Thursday).
  4. Overtime Management:
    • Add optional shifts for overtime:
      • First Shift Overtime:
        • Start Time: 4:00 PM
        • End Time: 8:00 PM.
      • Second Shift Overtime:
        • Start Time: 4:00 AM
        • End Time: 8:00 AM.

2. Configure Attendance with Biometric Devices

The Attendance module integrates employee clock-in and clock-out data to track working hours accurately.

Steps to Use Attendance Data:

  1. Enable Attendance App:
    • Go to Apps and install the Attendance module.
  2. Set Work Entry Source for Contracts:
    • Navigate to Employees > Employees > Contracts.
    • For each employee, set the Work Entry Source to Attendance. This ensures payroll is generated based on attendance data.
  3. Connect Biometric Devices:
    • Use a third-party integration or API to connect your biometric devices with Odoo.
    • Import attendance data using Settings > Attendance > Import Attendance Data or automate the process using a custom script.
  4. Verify Attendance Rules:
    • Navigate to Attendance > Employees and ensure clock-in/clock-out data aligns with the shift timings (e.g., 8:00 AM to 4:00 PM, 8:00 PM to 4:00 AM).

3. Configure Working Hours for Payroll

To accurately calculate payroll for shifts spanning two days, set up appropriate working hours and overtime rules.

Steps:

  1. Set Up Work Schedules:
    • Go to Settings > Employees > Work Schedules.
    • Create two schedules:
      • First Shift:
        • Working Hours: 8:00 AM to 4:00 PM.
      • Second Shift:
        • Working Hours: 8:00 PM to 4:00 AM.
    • Assign these schedules to employees based on their shift.
  2. Define Overtime Rules:
    • Navigate to Payroll > Configuration > Salary Structure.
    • Add rules for overtime calculation:
      • First Shift Overtime: 4:00 PM to 8:00 PM.
      • Second Shift Overtime: 4:00 AM to 8:00 AM.
    • Example Overtime Rule:
      result = worked_hours * overtime_rate
      
    • Include this in the salary computation.
  3. Assign Work Schedule to Employees:
    • Go to Employees > Employees > Contracts.
    • Assign the appropriate work schedule to each employee.

4. Avoid Split Attendance for Overnight Shifts

By default, Odoo splits attendance records if a shift spans two days (e.g., 8:00 PM to 4:00 AM). To avoid this:

Steps to Prevent Splitting:

  1. Modify Work Schedule:
    • Create a schedule that includes the full shift duration (e.g., 8:00 PM to 8:00 AM).
    • Assign this to employees in the Contracts tab.
  2. Combine Attendance Records:
    • Use Odoo's built-in tools or a customization to combine attendance records for shifts spanning two days.
    • Example Python logic:
      if record.start_date != record.end_date:
          record.duration = (record.end_time - record.start_time).total_seconds() / 3600
      

5. Generate Accurate Payslips

  1. Enable Payroll Module:
    • Go to Apps and install the Payroll module.
  2. Link Attendance to Payroll:
    • Navigate to Payroll > Configuration > Salary Structure.
    • Use the Work Entries integration to fetch attendance data for payroll computation.
  3. Run Payroll:
    • Go to Payroll > Payslips and generate payslips.
    • Ensure shift and overtime data are included in the payslip.

6. Test the Setup

  1. Create test employee records with assigned shifts.
  2. Simulate attendance data (clock-in/clock-out).
  3. Verify:
    • Attendance records match the defined shifts.
    • Overtime is correctly calculated.
    • Payslips reflect accurate working hours and overtime.

7. Additional Recommendations

  • Use Studio for Customizations:
    • If needed, use Odoo Studio to add custom fields or rules for attendance, shifts, or payroll.
  • Automate Data Import from Biometric Devices:
    • Set up a cron job or third-party integration for seamless data import.
  • Monitor and Adjust:
    • Regularly check shift compliance and adjust schedules or rules as necessary.

By configuring the Planning, Attendance, and Payroll modules as described, you can effectively manage shifts spanning two days and generate accurate payslips for your factory workers. Let me know if you need further assistance!

Avatar
Discard