我是 odoo
的初学者,我有xml文件,该文件中包含记录:-
<record id="test_rule_on_create" model="base.automation">
<field name="name">Base Automation: test rule on create</field>
<field name="model_id" ref="base_automation.model_base_automation_lead_test"/>
<field name="state">code</field>
<field name="code" eval="'records.write({\'user_id\': %s})' % ref('base.user_demo')"/>
<field name="trigger">on_create</field>
<field name="active" eval="True"/>
<field name="model_id" ref="base_automation.model_base_automation_lead_test"/>
<field name="filter_domain">[('state', '=', 'draft')]</field>
</record>
<record id="test_rule_on_write" model="base.automation">
<field name="name">Base Automation: test rule on write</field>
<field name="model_id" ref="base_automation.model_base_automation_lead_test"/>
<field name="state">code</field>
<field name="code" eval="'records.write({\'user_id\': %s})' % ref('base.user_demo')"/>
<field name="trigger">on_write</field>
<field name="active" eval="True"/>
<field name="model_id" ref="base_automation.model_base_automation_lead_test"/>
<field name="filter_domain">[('state', '=', 'done')]</field>
<field name="filter_pre_domain">[('state', '=', 'open')]</field>
</record>
谁能帮助我,如何在python中转换此记录? 预先谢谢你!
答案 0 :(得分:2)
这取决于要转换的数据格式。您可以阅读本教程:https://www.oreilly.com/learning/jxmlease-python-xml-conversion-data-structures