Skip to Content
Menu
This question has been flagged

I am creating this excel report, when I used if condition for a field its showing the following error

  File "/opt/data-dir/addons/13.0/claim_report/wizard/claim_report.py", line 159, in action_print_claim_report
    elif 'Egypt' in claim.patient_id.nationality.name:
TypeError: argument of type 'bool' is not iterable

Please check out my python code:
if 'Saudi Arabia' in claim.patient_id.nationality.name:
worksheet.write(row, 13, 'SAUDI')
elif 'Syria' in claim.patient_id.nationality.name:
worksheet.write(row, 13, 'SYRIAN')
elif 'Egypt' in claim.patient_id.nationality.name:
worksheet.write(row, 13, 'EGYPTIAN') ----> Error
elif 'Lebanon' in claim.patient_id.nationality.name:
worksheet.write(row, 13, 'LEBANESE')
elif 'India' in claim.patient_id.nationality.name:
worksheet.write(row, 13, 'INDIAN')
elif 'Pakistan' in claim.patient_id.nationality.name:
worksheet.write(row, 13, 'PAKISTANI')
elif 'Nepal' in claim.patient_id.nationality.name:
worksheet.write(row, 13, 'NEPALI')
elif 'Sudan' in claim.patient_id.nationality.name:
worksheet.write(row, 13, 'SUDANESE')
elif 'Botswana' in claim.patient_id.nationality.name:
worksheet.write(row, 13, 'BOTSWANIAN')
elif 'Canada' in claim.patient_id.nationality.name:
worksheet.write(row, 13, 'CANADIAN')
elif 'Jordan' in claim.patient_id.nationality.name:
worksheet.write(row, 13, 'JORDANIAN')
elif 'United Arab Emirates' in claim.patient_id.nationality.name:
worksheet.write(row, 13, 'EMIRATI')
elif 'Oman' in claim.patient_id.nationality.name:
worksheet.write(row, 13, 'OMANI')
elif 'Bahrain' in claim.patient_id.nationality.name:
worksheet.write(row, 13, 'BAHRAINI')
elif 'Kuwait' in claim.patient_id.nationality.name:
worksheet.write(row, 13, 'KUWAITI')
elif 'Philippines' in claim.patient_id.nationality.name:
worksheet.write(row, 13, 'FILIPINO')
else:
worksheet.write(row, 13, claim.patient_id.nationality.name)


Avatar
Discard
Author Best Answer

Its done, I simply used

if claim.patient_id.nationality.name == 'Egypt':

 

 

Avatar
Discard
Related Posts Replies Views Activity
1
Feb 22
61
0
Jan 22
83
0
Feb 22
52
0
Feb 22
50
3
Jan 20
5150