Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3531 Widoki
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>

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
mar 24
1611
2
gru 22
2091
2
sie 20
6181
2
maj 24
2257
1
mar 24
1454