Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
3927 Lượt xem

Hi,

I am trying to create a salary rule based on the nationality as we need to have to book air ticket allawance based on the home country of the employee.

I tried result = employee.nationality == 'Philippines' or false

but I am getting an error on that.

 

any help will be appreciated.

 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Try this:

result = employee.country_id.name == 'Philippines' or false

Update:

if  employee.country_id.name == 'Philippines':
   result = 0
elif  employee.country_id.name == 'Poland':
   result = 1000
else:
   result = 1
 

 

 

 

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Hi Zbik,

Thanks for the quick response, but how can make that with a nested if? is that possible as I need to test difference conditions against the country of the empoyee.

I had to edit this since I can reply to the second reply. 

 

Thank Zbik, but I assume this code goes in the Conditions section. what would be used on the compution part?

Ảnh đại diện
Huỷ bỏ

answer updated

See, as demo, l10n_be_hr_payroll_data.xml in module l10n_be_hr_payroll

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 3 24
1683
0
thg 3 24
1406
2
thg 2 24
1898
0
thg 5 23
1776
0
thg 5 23
3692