Odoo Help


read the drop down field from HR in Payroll Salary Rules

Ken Kasai
on 1/29/15, 7:05 AM 1,943 views

I created a salary rule and I created a python condition in Payroll Salary Rules. Im trying to get the value from gender (drop down list) field in hr. But seems like isnt working. need help. thank you

Python Condition:

if (employee.gender== "Male"):
  result = 1
elif (employee.gender== "Female"):
  result = 2


thank you. but how about if I want to get the value from a custom object and the field is many2one and also drop down list with create and edit?

Ken Kasai
on 1/29/15, 7:38 AM

many2one is different from selection. It is basically a foreign key to another model/table. The value stored is the (database) id. So, if you want to compare it to a specific id, use field_to_compare.id = 999 (where 999 is the database id). Further you can compare it with the different fields that field_to_compare has.

on 1/30/15, 12:08 PM

Atchuthan - Technical Consultant, Sodexis Inc

--Atchuthan - Technical Consultant, Sodexis Inc--
| 5 5 8
Puducherry, India
--Atchuthan - Technical Consultant, Sodexis Inc--
Passionate coder in Python/Odoo(formerly known as OpenERP).

Contact me via GMail: atchuthantu@gmail.com via Skype: atchuthan_skype
via Linkedin: http://in.linkedin.com/in/atchuthantu
Atchuthan - Technical Consultant, Sodexis Inc
On 1/29/15, 7:18 AM

In HR module, the gender field is defined as 
'gender': fields.selection([('male', 'Male'),('female', 'Female')], 'Gender'),

So, to check whether gender is male or female, we use the key instead of value to check any SELECTION.
if (employee.gender== "male"):
  result = 1
elif (employee.gender== "
  result = 2

how i can set date in condition change gender with date

ahmad safi
on 3/2/15, 3:59 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 1/29/15, 7:05 AM
Seen: 1943 times
Last updated: 3/16/15, 8:10 AM