[英]How to write python code for salary rule in odoo
I am trying to write the python code in the Computation part of the salary rules in the payroll module.我正在尝试在工资模块的工资规则的计算部分编写 python 代码。
result = payslip.salaryrule()
In the payslip module, I'm creating the salaryrule function like this -在工资单模块中,我正在创建这样的工资规则函数 -
class CustomPayslip(models.Model):
@api.multi
def salaryrule(self):
hourly_rate = self.emp_amount
return round(self.billable_hours * hourly_rate, 2)
But when I create a employee payslip and click on Compute Sheet button, I get this error from flectra - Wrong python code defined for salary rule.但是,当我创建员工工资单并单击“计算表”按钮时,我从 flectra 收到此错误 - 为工资规则定义了错误的 Python 代码。
try to add the code directly into the rule尝试将代码直接添加到规则中
hourly_rate = self.emp_amount
result = round(self.billable_hours * hourly_rate, 2)
and try payslip instead of self并尝试工资单而不是自己
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.