Salary rules¶
In Odoo, every salary structure has a set of salary rules used to compute the various amounts considered in the pay. These rules are configured by the localization and affect the computation of the salaries.
Warning
Modification or creation of rules should only be done when necessary.
To view all the rules, go to . Click on a structure, such as Regular Pay, to view all the rules.
Add a new rule¶
To make a new rule, click New and a blank Salary Rules form loads. Enter the following information in the top half of the form:
Rule Name: Enter a name for the rule. This is the name displayed in the payslip.
Code: Enter a code to be used for the new rule. This is case sensitive and is used as the rule ID. This field is required.
Category: Using the drop-down menu, select the category the rule applies to, or enter a new category. The category is used to group rules and access their total sum.
Salary Structure: Using the drop-down menu, select the salary structure the rule applies to, or enter a new one. This field is required.
Sequence: Enter a number indicating when the rule is calculated, in the sequence of all other rules. Rules are processed one after another based on their sequence number. Rules with a lower sequence number are calculated first, and their results can be used by rules with a higher sequence number. This field is required.
Appears on Payslip: Enable this checkbox to have the rule visible on the employee payslip PDF.
Contributes to Employer Cost: Enable this checkbox to include the rule when computing the employer cost of a payslip.
General tab¶
Fill out the following sections of the General tab. These configurations determine when and how the rule is calculated.
Conditions¶
Condition Based on: Using the drop-down menu, select if the rule is calculated and displayed as a line in the payslip form view. Choose from one of the following options:
Always True: The rule is always calculated. No other configurations are needed for this section.
Salary Input: This introduces a dynamic benefit to the structure. This appears as a field in the Payroll tab of the Employee form, the Inputs tab of the payslip, or both. The value of this field is added to the amount of the rule. If selected, the following additional fields appear and must be configured:
Input on: Specify where this field should appear and which object it should belong to, the Employee, the Payslip, or both. If both are selected, the value on the payslip automatically defaults to the value from the employee record, but it can be overwritten directly on the payslip for a specific payroll run.
Section: This groups several inputs into one expandable section on the form view. Only one option is available by default: Inputs.
Unit: Click the corresponding radio button to determine how the benefit is displayed. The available options are:
Monetary: A number with currency.
Quantity: A number.
Percentage: A number with a % sign.
Checkbox: Indicates boolean values.
Input Description: Enter a short explanation of when the input is applicable.
Default Value: Enter the default value, either a monetary amount, quantity, or percentage. This is determined by what is selected for the Unit. If necessary, add a Suffix in the field to the right of this value, such as
per km.Note
If Checkbox is selected for the Unit, this field changes to Selected by Default. Click the checkbox to have the rule active by default.
Depends On: Select another rule that has a salary input, and use its value to determine whether this rule should be hidden.
Other Input: Select this to check if a payslip line exists with the same type. When selected, a Condition Other Input field appears. Using the drop-down menu, select the type of input the rule is based on, such as Deduction, Reimbursement, etc.
Python Expression: Select this to have the rule calculated using a Python script. The script is evaluated using the local dictionary. The right side lists the Available variables and the Output:
Available variables:
payslip: The
hr.payslipobject.employee: The
hr.employeeobject.version: The
hr.versionobject.result_rules: A dictionary containing the rules amounts, quantities, rates and totals (previously computed).
categories: A dictionary containing the computed salary rule categories (the sum of the amount of all the rules belonging to that category):
total: rule total
amount: rule amount
quantity: rule quantity
rate: rule rate
ytd: rule year to date value
worked_days: A dictionary containing the computed worked days, where each key is a work entry type code, and each value is a
worked_daysobject. This object contains many variables, with the most important ones being:number_of_days: The number of days registered in the payslip duration with this work entry type.
number_of_hours: The number of hours registered in the payslip duration with this work entry type.
is_paid: Whether or not this work entry type is added as an unpaid work entry on this payslip structure.
inputs: A dictionary containing the computed inputs where key is the other input type code and value is the sum of the payslip input lines with the same code.
Output:
result: The boolean is True if the rule should be calculated, or False if otherwise.
Domain: Select this option to apply the rule only if it matches the configured Applicability Domain. Configure the Applicability Domain that appears beneath this option when selected.
Computation¶
This section determines the final value of the rule, which consists of the base amount, the
quantity, and the rate. The total of the rule is total = amount * quantity * (rate/100).
Important
This field does not appear if the Condition Based on field is set to Salary Input.
Using the drop-down menu, select one of the following options for the Amount Type field:
Percentage (%): Defines the values for the total calculation. When selected, configure the following fields:
Percentage based on: A Python expression is evaluated using the
localdict, and its value is assigned to the rule amount.Quantity: A Python expression is evaluated using the
localdict, and its value is assigned to the rule quantity.Percentage (%): A decimal number assigned to the rule rate.
Fixed Amount: The amount and quantity is defined, with a rate of 100%.
Quantity: A Python expression is evaluated using the
localdict, and its value is assigned to the rule quantity.Fixed Amount: Enter a decimal number which is assigned to the rule amount.
Other Input: Select this to fetch the rule amount from the payslip input lines that have the same other input type with rate of
100%and quantity of1.0. When selected, an Amount Other Input field appears beneath it. Using the drop-down menu, select the type of input it is, such as Deduction, Tips, or Expenses.Python Code: This is the more complex version of the Percentage (%) option, where a whole Python script is written then evaluated using the
localdict. This includes a list of Available variables and an Output list.Available variables:
payslip: hr.payslip object
employee: hr.employee object
version: hr.version object
result_rules: A dict containing the rules amounts, quantities, rates and totals (previously computed), where the key is the rule code, and the value is dict with the following keys:
total: rule total
amount: rule amount
quantity: rule quantity
rate: rule rate
ytd: rule year to date value
categories: A dict containing the computed salary rule categories (sum of amount of all rules belonging to that category) where key is the category code and value is the sum of the rules total values.
worked_days: A dict containing the computed worked days where key is the work entry type code and value is the
worked_daysobject contain many variables, but most important ones are:number_of_days: The number of days registered in the payslip duration with this work entry type.
number_of_hours: The number of hours registered in the payslip duration with this work entry type.
is_paid: Dictates whether or not this work entry type is added as unpaid work entry on this payslip structure.
inputs: A dict containing the computed inputs, Where key is the other input type code and value is the sum of the payslip input lines with the same code.
Output:
result: float, base amount of the rule
result_rate: float, which defaults to 100.0 (%)
result_qty: float, quantity, which defaults to 1
result_name: string, name of the line. This defaults to the name field of the salary rule (useful if the name depends or should depend on something computed in the rule).
Company contribution¶
Using the drop-down menu, select the eventual third party involved in the salary payment to the employees.
Display tab¶
This section determines the appearance of the rule on the payslip PDF available to the employee, and defines the rule aesthetics.
First, select a Color for the rule using the color picker. Next, enable the Title checkbox to only display the salary rule’s title and description, and hide any numerical values.
Activate the Indented, Space Above, Bold, Underline, and Italic checkboxes to activate the respective options.
Finally, enter a Description for the rule, which is displayed below the rule name.
Accounting tab¶
This section determines how the rule affects the various accounting journals and how the Net salary is calculated for employees. Configure the following fields in this section:
Debit Account: Using the drop-down menu, select the debit account for the rule.
Credit Account: Using the drop-down menu, select the credit account for the rule.
Split on names: Enable this option to split the accounting entries for this rule according to the payslip line name. Splitting the entries provides more visibility for deductions and reimbursements, or for salary adjustments.
Excluded from Net: Check this checkbox to exclude the rule’s calculations from the net salary rule in journal entries. A specific debit and credit account should be set to independently classify it.
Set employee on account line: Check this checkbox to have the employee’s name visible on the journal items.
Important
This tab is only available if the Accounting app is installed.
Rule parameters¶
Rule parameters inform Odoo how to calculate each line of a payslip. To view the configured rule parameters, navigate to .
All rule parameters are displayed. Click on an individual rule parameter to view the details.
Each rule parameter displays the name of the rule, the code, when the rule is active, and the parameter value.
Rule categories¶
Every rule is associated with a rule category. To view the various categories, navigate to .
All rule categories appear in a list view, and display the category Name, Code, and Country.
To create a new rule category, click the New button. Enter a Name and Code for the category in the corresponding fields. If the category is housed beneath a Parent category, select the parent category using the drop-down menu. If the category is country-specific, select the Country using the drop-down menu.