def generate_header(self):
root = etree.Element('TAG1',)
for inv in self.env['account.invoice'].search([]):
po_code = etree.SubElement(root, 'data').text = str(inv.id)
return root
How can i add another tag inside for loop. if i put root inside for loop then it generates xml file for 1 record. i need it to look like this.
<tag1>
<tag2>
<data>my data<data>
</tag2>
</tag1>