我必须在3个条件下计算带薪休假的工资单。
E.g:
result = worked_days.Medical and worked_days.Medical.number_of_days or False
if(result>25):result=contract.wage-10000
elif(result<25 and result>10):reuslt=contract.wage-20000
else:result=30000`
答案 0 :(得分:2)
为WORK100
创建医疗代码,而不是您可以在薪资规则中访问。比如worked_days.Medical.no_of_medical_leave_days
,否则会出现Wrong python code.
<record id="hr_rule_medical_days" model="hr.salary.rule">
<field name="name">Medical Leave Days</field>
<field name="sequence" eval="1"/>
<field name="code">MEDICAL</field>
<field name="category_id" ref="hr_payroll.DED"/>
<field name="condition_select">none</field>
<field name="amount_select">code</field>
<field name="amount_python_compute">result = 0
days = worked_days.Medical.no_of_medical_leave_days
if days>25:
result=100000;
elif(days<25 and days>10):
result=20000;
else:
result=30000</field>
</record>
另外,将上述hr_rule_medical_days
的 ID 添加到Salary Structure