Pay slip can be entered into multiple worked_days_line and input_line, used to manually adjust the salary changes, such as sales commission, debit and so on. Pay slip can contain multiple pay slip line used to store Hr.salary.rule computed results.
??
??
Hr.salary.rule defines the payroll rules
??
When calculating the wage rules, the context parameters stored in the Localdict dictionary are used
{' Categories ': categories_obj, ' rules ': rules_obj, ' payslip ': payslip_obj, ' worked_days ': worked_days_obj, ' inputs ': Input_obj, ' employee ': employee_id, ' contract ': contract}
That is, these variables
- Payslip:object containing the payslips
- Employee:hr.employee Object
- Contract:hr.contract Object
- Rules:object containing the rules code (previously computed)
- Categories:object containing the computed salary rule categories (sum of amount of all rules belonging to that category).
- Worked_days:object containing the computed worked days.
- Inputs:object containing the computed inputs.
??
Method Compute_rule () calculates the salary rules, returns amount, qty, rate, and the three are the salaries defined by the rule, the results of which are grouped together to form the total salary, and the combination of these rules is the salary structure.
??
There are three types of calculations
- Fix
- Percentage
- Python Code
??
If it is fix, the formula saved by the field quantity is executed using Python eval to get the result qty
method Compute_rule () returns the result as Fixed_amount, qty, 100.0
For example:
Weekdays 10 per day
??
If it is percentage, the formula Amount_percentage_base saved by the field is executed using Python eval, resulting in the result percentage_base
method Compute_rule () returns the result as percentage_base, qty, percentage
For example:
12.5% Deduction of Wages
??
In the case of Python code calculations, the Python eval is used to execute the field Amount_python_compute, which is the Python code saved formula, resulting in result = XXX
The format of Python code must be result =
method Compute_rule () returns the result as result, result_qty or 1.0, result_rate or 100.0
??
??
For example:
Calculate a business commission using inputs data
??
And
Call the Payroll Rule Classification and add
??
Odoo HR Payslip