Skip to Content
Menu
This question has been flagged
2809 Views
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>

Avatar
Discard
Related Posts Replies Views Activity
2
Mar 24
457
2
Dec 22
1368
2
Aug 20
4539
2
May 24
496
1
Mar 24
1454