What I wanted is to parse the xml data using Element tree.
Can you give me some example on how to apply the etree?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Księgowość
- Zapasy
- PoS
- Project
- MRP
To pytanie dostało ostrzeżenie
1
Odpowiedz
4139
Widoki
Hi,
As per the etree code you can import the etree and finding of the xml arch, in those cases it will be using full.
import xml.etree.ElementTree as xee
from lxml import etree
view_id = self.env.ref('model.model_view_name')
view_arch = str(view_id.arch_base)
doc = xee.fromstring(view_arch)
field_list = []
field_list_1 = []
for tag in doc.findall('.//field'):
field_list.append(tag.attrib['name'])
if 'attrs' in tag.attrib or not 'invisible' in tag.attrib['attrs']:
field_list_1.append(tag.attrib['name'])
//You can add your own conditions here
model_id = self.env['ir.model'].sudo().search(
[('model', '=', 'model_name')])
return [('model_id', '=', model_id.id), ('state', '=', 'base'),
('name', 'in', field_list)]
Regards
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
1
sie 24
|
1029 | ||
|
1
mar 15
|
4297 | ||
|
0
sie 24
|
4 | ||
|
3
mar 24
|
26137 | ||
|
0
lis 16
|
5083 |