Salary Rules in Odoo 16 payslip | Managing Employees’ Salaries | Loans etc

HARSHAD
January 13, 2023

Salary computation in the employee’s payslip when an employee takes a loan and leaves in Odoo 16

 A payslip for the employee is given based on each month. If an employee takes leave or loan or overtime, they are categorized as allowance or deduction. So we have to create a salary rule for the computation of salary including all the allowances and deductions in the payslip.

Salary rule for loan:

<record id="hr_rule_payroll" model="hr.salary.rule">

           <field name="name">Loan</field>

           <field name="sequence" eval="100"/>

           <field name="code">LOAN100</field>

           <field name="category_id" ref="om_hr_payroll.DED"/>

           <field name="amount_select">code</field>

           <field name="amount_python_compute">result = (inputs.LOAN100 and inputs.LOAN100.amount)</field>

       </record>




        <!-- Rule Inputs -->




       <record id="hr_rule_input_loan" model="hr.rule.input">

           <field name="code">LOAN100</field>

           <field name="name">Loan</field>

           <field name="input_id" ref="hr_rule_payroll"/>

       </record>

This is the salary rule for loans and in the payslip Odoo it will reflect and come under the deduction category.

salary-rule-for-loanSo here the particular takes a loan of 1000 and he pays back the amount in installments in two rounds of 500 each month. So here we can see the loan added as a second line in other inputs LOAN100  is the code for the loan in salary structure and the amount 500 is also added and admin01 is the particular contract for the employee.

loan-installments-odoo-pay-slipsWhen we compute the sheet, the salary for the particular employee will be computed for the particular month. Here the salary of the employee is 15000 and the loan installment amount is 500. So the final net salary for the employee will be 14500(deducting the loan from the basic salary).

Salary rule for leaves:
 

<record id="hr_rule_unpaid" model="hr.salary.rule">

           <field name="name">Unpaid Leave</field>

           <field name="sequence" eval="100"/>

           <field name="code">UNP</field>

           <field name="category_id" ref="om_hr_payroll.DED"/>

           <field name="condition_select">none</field>

           <field name="amount_select">code</field>

           <field name="amount_python_compute">result = (categories.GROSS / worked_days.WORK100.number_of_days)*(worked_days.Unpaid.number_of_days) if worked_days.Unpaid else 0</field>

       </record>

 

This is the rule for unpaid leave. Also, leaves come under the category of deduction.

We can see that the unpaid leave appears in the working days and 1 deduct from normal working days’ unpaid leave days. The total working days is 22. So subtracting unpaid leave one day and compensatory leave half a day result total of 20.50.

So also in salary computation, this unpaid leave amount calculated as per the salary rule will appear in the salary computation and will also be deducted from the basic salary.

Other than leave and loan, there will be also other factors that will reflect in the payslip of an employee. They are:

1. Overtime

2. Compensatory leave, etc.

Overtime also works like leaves and loans. They also have a salary rule. In certain conditions, there will be two or three overtime types. As per the client’s requirement, we can add three overtime separately in the payslip by defining separate salary rules for three of them or can mention single overtime. In this way, the payslip of an employee is generated.

"Unlock the Full Potential of Your Business with Odoo ERP!"

"Get a Cost Estimate for Your ERP Project, Absolutely FREE!"

Get a Free Quote

Leave a Reply

Your email address will not be published. Required fields are marked *