revivenote revivenote - 16 days ago 15
Python Question

Odoo 9 Salary Rule based on country

I am trying to define a salary rule in Odoo 9 Payroll.

The rule condition has to be based on the employee's country. I tried the python expression code below but it does not work.

result = (employee.country_id=="Malaysia") or False


I'm aware that the field type of employee's country (nationality) is
many2one
with relation of
res.country
. I just couldn't figure out how it works.

Answer

This should work:

result = (employee.country_id.name == "Malaysia") or False