Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
3540 Представления
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>

Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
мар. 24
1622
2
дек. 22
2109
2
авг. 20
6194
2
мая 24
2279
1
мар. 24
1454