Hi,
I have created a form that has multiple items and I want to show that in a table format.
I created a table using
ET.Element() but don't know how to create multiple tables under one table.
Please help with this.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi,
I have created a form that has multiple items and I want to show that in a table format.
I created a table using
ET.Element() but don't know how to create multiple tables under one table.
Please help with this.
Hello Vikas Maharana,
from lxml import etree as ET
# Create the root element
root = ET.Element('root')
# Create the main table
main_table = ET.SubElement(root, 'table')
# Create the first sub-table under the main table
sub_table1 = ET.SubElement(main_table, 'table')
# Create the second sub-table under the main table
sub_table2 = ET.SubElement(main_table, 'table')
# Now you can add items to your sub-tables
item1 = ET.SubElement(sub_table1, 'item')
item1.text = 'Item 1'
item2 = ET.SubElement(sub_table2, 'item')
item2.text = 'Item 2'
In this example, sub_table1 and sub_table2 are both nested under main_table, which is nested under the root element. You can add as many sub-tables and items as you need in this way.
Please note that this is a generic example and you might need to adjust it according to your specific requirements in Odoo. If you’re dealing with relational fields like One2many or Many2many in Odoo, you might need to use different methods. For example, for a Many2many field, a list of tuples is expected. Here is the list of tuples that are accepted, with the corresponding semantics:
Hope this helps!
Best regards,
Maciej
Thanks
Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!
AanmeldenGerelateerde posts | Antwoorden | Weergaven | Activiteit | |
---|---|---|---|---|
Self hosting Odoo custom
Opgelost
|
|
1
aug. 24
|
1860 | |
|
13
mrt. 16
|
5318 | ||
|
1
sep. 15
|
6015 | ||
|
0
aug. 24
|
1449 | ||
|
2
aug. 24
|
2202 |