Odoo has an Integrated platform with Human Resources and Payroll Engine. Integrating human resources and payroll can reduce paperwork, allows automatic updating and reduce difficulty in providing consolidated reports. Odoo Hr Payroll engine that handles everything required to compute HR salary slips, the taxes to pay, etc. You can manage your company's payroll by using this hr_payroll module. Here We are going to discuss the basic payslip creation and make a salary rule to deduct Unpaid leaves from payslip.
Install Payroll, leaves add-ons. Employees can request leaves according to types specified. Unpaid leave is a type of leave which is in the category of deductions in payroll rules. If Unpaid leaves are approved by manager then while creating payslip of the current employee, it should be deducted. In the form view of payslip, we can see a list which holds the list of worked days, leaves and so on. Follow these steps to deduct Unpaid leaves pay.
1. Create a contract for employee
specifies the Working schedules, type, duration, basic wage, work permit details, scheduled pay and salary structure. Here salary structure is a set of rules which used to compute the payslip of a current employee.
2. Leave Request
From Leaves Menu Employee Gilles Requested 4 days Unpaid Leave and that is in Approved stage
3. Create salary rule to deduct unpaid leaves pay from payslip.
Goto -> payroll -> salaryrules -> create, then add this rule in contract's salary structure
- select a rule category [here we select deductions]
- Give a unique code
- Select conditions based on [none]- Always True
- Computation Based on [code] - Python Code.
- Python Code :-
# Available variables:
# payslip: object containing the pay slips
# employee: hr.employee object
# contract: hr.contract object
# rules: object containing the rules code (previously computed)
# categories: an object containing the computed salary rule categories
(sum of amount all rules belonging to that category).
# worked_days: object containing the computed worked days
# inputs: object containing the computed inputs
# Note: returned value have to be set in the variable 'result'
#Our Computation code to calculate amount In case of 31 days
result =-(contract.wage/31) * worked_days.Unpaid.number_of_days
result = 0
4. Create payslip for the employee
Goto -> payroll -> payslips -> create
Here the Worked days' list is populated with taken leaves
- Compute sheet to see calculations as per salary rules
- You can see the computed Unpaid leaves pay as a deduction on the computer sheet.