Salary Rules formula definition (Python)
In python definition in salary rules, you can write any code like you will do
in python. Any methematical operation or python function is supported.
The following objects and variables are available to you to use it in salary rules calculations.
-
payslip: contains current payslip object data (hr.payslip)
-
payslips: contains payslips data (Payslips - Browsable Object)
-
employee: contains current employee object data (hr.employee)
-
contract: contains current contract object data (hr.contract)
-
rules: contains the rules code (previusly computed)
-
categories: contains the sum of amount of all rules belonging to that category
-
worked_days: contains the computed worked days data
-
inputs: contains the computed input data
-
payroll: contains miscellaneous values related to payroll
-
current_contract: contains values related/calculated for current contract
-
result_rules: contains the values of previusly computed lines (qty, rate, amount, total)
-
tools: contains tools and libraries which help with mathematical operations
The calculations should be performed using the objects and variables below.
Then, you have to use specific compute variables which will store the data
for salary rule computation.
-
result: the returned value should be in this variable. It matches with "amount" column.
-
result_rate: the rate that should be applied to "result"
-
result_qty: the quantity of units that will be multiplied to "result"
-
result_name: overrides the current name of the rule and allows to make dynamic names
Examples
-
result = contract.wage * 0.10
-
result = contract.wage
result_qty = worked_days.WORK100.number_of_days
-
result = contract.wage
result_rate = 10.0