I have to calculate payslip with medical leave for 3 conditions.
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`
try this, I coded in air. Hope this help.
Create a code for Medical as WORK100
has and than you can access in salary rules. like worked_days.Medical.no_of_medical_leave_days
otherwise it's give error like 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>
And additionally add id of above hr_rule_medical_days
to with Salary Structure