This question has been flagged
2 Replies
5966 Views

  Hello,

 I am creating salary slip based on gender from payroll module. if gender is female then i want deduct 10% from basic salary. For that i have create 

Condition: result = employee.gender == "female".

Computation:

Amount Type: Percentage

Percentage based on:BASIC

Quantity:1

Percentage(%):  -10

But when generating pay slip above error will be shown "Wrong python condition defined for salary rule".  Not understand what is wrong in my code . can any please help.

Thanks.




Avatar
Discard
Best Answer

I am not sure what is wrong with your condition, but I can guide you how to figure it out.

Go to "hr_payroll / models / hr_payroll.py" and search for "def compute_rule" method. Now comment out the try and except part and try to compute the payslip again. You would see original error causing the issue which could help you to fix that.

Avatar
Discard
Best Answer

Condition: result = employee.gender == "female".

You are assigning a comparison to 'result' variable, which is not proper. result variable contains an amount to show in payslip.

Avatar
Discard

He is trying to add the code in the python condition field and not in the python code field. You are right result should have amount value but it is for python code and not for python condition.

Yes you are correct , ididn't notice condition field

Yes..@Sudhir Arya I am write code in python condition field, not in python code field. But after some try my code work properly. Thanks to you and @Jithin for time and suggestion

On 24/09/19 2:17 PM, Sudhir Arya (ERP Harbor Consulting Services) wrote:

He is trying to add the code in the python condition field and not in the python code field. You are right result should have amount value but it is for python code and not for python condition.

Sent by Odoo S.A. using Odoo.