Problem Description
I'm working on an Odoo v17 implementation and need assistance modifying the way total annual leave accruals are calculated. Currently, the system calculates accruals from a given date, but I need to exclude periods of unpaid leave from this calculation.
Desired Functionality
- The accrual calculation should subtract the days of unpaid leave from the total worked days before calculating the accrued leave.
- This should affect the balance of available leave days for the employee.
Example Scenario
Let's consider an employee "Demo User" with the following details:
- Accrual plan: 20 days per year
- Employment period: 2021-04-26 to 2024-08-27 (approximately 1220 days)
- Unpaid leave taken: 38 days
Current Calculation (Default Odoo)
- Accrued leave: (1220 * 20) / 365 ≈ 66.85 days
- If 65 days have been used, the balance would be: 66.85 - 65 = 1.85 days left
Desired Calculation
- Adjusted work period: 1220 - 38 = 1182 days
- Accrued leave: (1182 * 20) / 365 ≈ 64.77 days
- If 65 days have been used, the balance would be: 64.77 - 65 ≈ -0.23 days (or 0 days left)
Questions
- Is there a way to modify the existing leave accrual module to accommodate this calculation?
- If not, what would be the best approach to implement this custom calculation?
- Are there any potential issues or considerations we should be aware of when making this change?
Any guidance, code snippets, or module recommendations would be greatly appreciated. Thank you in advance for your help!