Enable Dark Mode!
HR-Unpaid-Leaves-payroll-Management-in-Odoo-10.png
By: Hilar AK

HR,Unpaid Leaves & Payroll Management in Odoo 10

Functional Odoo 10 Human Resource

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

HR-Unpaid-Leaves-payroll-Management-in-Odoo-10-1-cybrosys

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

HR-Unpaid-Leaves-payroll-Management-in-Odoo-10-2-cybrosys

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.

HR-Unpaid-Leaves-payroll-Management-in-Odoo-10-3-cybrosys

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
try:
result =-(contract.wage/31) * worked_days.Unpaid.number_of_days
except:
result = 0


4. Create payslip for the employee

Goto -> payroll -> payslips -> create

HR-Unpaid-Leaves-payroll-Management-in-Odoo-10-4-cybrosys

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.

HR-Unpaid-Leaves-payroll-Management-in-Odoo-10-5-cybrosys


If you need any assistance in odoo, we are online, please chat with us.



11
Comments

Muhammad Rustom

the code i used is try: result =-(contract.wage/30) * worked_days.Unpaid.number_of_days except: result = 0 the result always 0 please hepl

30/12/2019

-

3:45AM

Anjila Jolly

I have gotten a lot of information thanks

28/05/2019

-

4:19AM

Anna

wow!! want to get best actual payroll management this is best proper system which is very helpful to us payroll always his better services you should keep up your writing Thanks for sharing best way to provide payroll solutions

27/03/2019

-

1:20PM

Kamlesh Vadhiya

very usefull Thanks

21/09/2018

-

12:19AM

Hillar AK

@sanu that should be the error in your code. just clear all unwanted characters in python code form and Have a try. If your rule's code is UNPAID then the code defined in the blog is correct. That is tested. Please have a look at the contract you defined also. If you want to know, how can configure salary rules, check odoo's official documentation or check other blogs related to the salary rule.

19/10/2017

-

6:25AM

Hilar AK

@sanu "Python code wrong " which actually deals on the rule. We are defining the python code here. So while trying to access objects which are not there on payslip will generate Error. So you must check the rule you have created. Don't forget to check the code that you have given on rule and also related configurations done properly. Feel to free to contact our support.

19/09/2017

-

6:32AM

sanu

Hello sir. I had followed your steps but unfortunately "Python code wrong " error popped up. i hope you will respond to this reply . I'm using Odoo 10 community

19/09/2017

-

1:51AM

Mohamed

I'm really thankful for the information

17/03/2019

-

6:57AM

Jay

I used the same code,but I get the error message ' Wrong python code defined for salary rule Unpaid (UNPAID).'

16/10/2017

-

8:46AM

reena

Very useful information. Thanks for sharing.

11/07/2018

-

4:33AM

Muhammad Kamran

Try This Condition Based on: Python Expression Python Condition: result = worked_days.Unpaid and worked_days.Unpaid.number_of_days or False Amount Type: Python Code Python Code: result = -(contract.wage/30) * worked_days.Unpaid.number_of_day

02/11/2017

-

5:44AM



Leave a comment



whatsapp_icon
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message