1

Good day, I have a field many2many (toothNumbers) and I want to list it's data (name) in ElementTree file(xml) I am generating with python in Odoo15. I need to list them but showing each it's name, not ids.

I have written many for & while loops but I have failed please help. Below is part of my Code.

for claims_line in claim.claim_line_ids:
    line_no += 1
    
    Line = etree.Element("Line")
    
    lineNo = etree.SubElement(Line, "lineNo")
    lineNo.text = str(line_no) or ''

           
                    
    for line_toothNumbers in range(len(claims_line.toothNumbers)):

        get_toothNumbers = claims_line.toothNumbers[line_toothNumbers.name]
    
    toothNumbers = etree.SubElement(Line, "toothNumbers")
    toothNumbers.text = str(get_toothNumbers) or ''
Abraham Kalungi
  • 45
  • 1
  • 10
  • I am sure there would be an easy way to do this are you sure `widget="many2many_tags"` will not work for you can you update the question with what you are trying to do, like how you want it to look in the end – Muhammad Yusuf Jun 02 '22 at 05:35
  • Hey @MuhammadYusuf, I think I have explained everything, you didn’t read, many2many_tags I can not use it in ElementTree – Abraham Kalungi Jun 02 '22 at 06:02

0 Answers0