pay slip 可以录入多条 worked_days_line 和 input_line,用来人工调整薪资变动部分,比如销售提成,扣款等。 pay slip 可以包含多个pay slip line 用来存储 Hr.salary.rule 计算出的结果。

   

   

Hr.salary.rule 定义了薪资规则

   

计算工资规则的时候,会使用 localdict 字典里存放的上下文参数

{'categories': categories_obj, 'rules': rules_obj, 'payslip': payslip_obj, 'worked_days': worked_days_obj, 'inputs': input_obj,'employee':employee_id, 'contract ':contract }

也就是这些变量

  • 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.

   

方法compute_rule()计算薪资规则,返回 amount, qty, rate ,三者相乘就是该条规则所定义的薪资,这些规则计算的结果组合在一起,就组成了薪资总额,而这些规则的组合就是薪资结构。

   

有三种计算类型

  • Fix
  • Percentage
  • Python code

   

如果是Fix,则会使用Python eval执行字段quantity 保存的公式,得到结果 qty

方法compute_rule()返回结果为 fixed_amount, qty, 100.0

例如:

Odoo HR Payslip

工作日每天10元

   

如果是percentage,则会使用Python eval执行字段 amount_percentage_base保存的公式,得到结果percentage_base

方法compute_rule()返回结果为 percentage_base, qty, percentage

例如:

Odoo HR Payslip

扣减工资的12.5%

   

如果是Python code计算方式,则会使用Python eval执行字段 amount_python_compute即Python code保存的公式,得到结果result = xxx

python code的格式必须是 result =

方法compute_rule()返回结果为 result, result_qty or 1.0, result_rate or 100.0

   

   

例如:

Odoo HR Payslip

使用inputs数据,计算业务提成

   

以及

Odoo HR Payslip

调用薪资规则分类,并相加

   

相关文章:

  • 2021-05-23
  • 2021-10-27
  • 2021-09-18
  • 2021-09-09
  • 2022-02-27
  • 2021-09-16
  • 2022-03-01
猜你喜欢
  • 2021-07-15
  • 2021-06-21
  • 2021-12-23
  • 2021-07-28
  • 2021-10-27
相关资源
相似解决方案