Openerp payslip带有python代码的工资规则

时间:2014-04-25 03:51:37

标签: python openerp-7

我必须在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`

1 个答案:

答案 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