尝试安装模块时出现错误。我相信外部ID是指view_id:
raise ValueError('External ID not found in the system: %s' % (xmlid))
ParseError: "External ID not found in the system: nk_test.bom_where_use_form" while parsing /opt/odoo/odoo/addons/nk_test/mrp_where_bom.xml:4, near
<record id="action3" model="ir.actions.act_window">
<field name="name">Where Use</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.template</field>
<field name="view_type">form</field>
<field name="target">new</field>
<field name="view_id" ref="bom_where_use_form"/>
</record>
这是我的xml文件。形式&#34; bom_where_use_form&#34;是定义的,我不知道为什么它不可见。
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="action3" model="ir.actions.act_window">
<field name="name">Where Use</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.template</field>
<field name="view_type">form</field>
<field name="target">new</field>
<field name="view_id" ref="bom_where_use_form"/>
</record>
<record id="ir_BOM_structure3" model="ir.values">
<field eval="'client_action_multi'" name="key2"/>
<field eval="'product.template'" name="model"/>
<field name="name">Where Use</field>
<field eval="'ir.actions.act_window,'+str(action3)" name="value"/>
</record>
<record id="action4" model="ir.actions.act_window">
<field name="name">Where Use</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.product</field>
<field name="view_type">form</field>
<field name="target">new</field>
<field name="view_id" ref="bom_where_use_form"/>
</record>
<record id="ir_BOM_structure4" model="ir.values">
<field eval="'client_action_multi'" name="key2"/>
<field eval="'product.product'" name="model"/>
<field name="name">Where Use</field>
<field eval="'ir.actions.act_window,'+str(action4)" name="value"/>
</record>
<record id="bom_where_use_form" model="ir.ui.view">
<field name="name">bom.where.use.form</field>
<field name="model">product.template</field>
<field name="priority" eval="20"/>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="text_field" on_change="onchange_template_id(100)" readonly="1" />
</field>
</record>
</data>
</openerp>
我想知道缺少什么。
答案 0 :(得分:4)
尝试将bom_where_use_form
移到XML文件的顶部。使用ref
参数时,这似乎是一个问题:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="bom_where_use_form" model="ir.ui.view">
<field name="name">bom.where.use.form</field>
<field name="model">product.template</field>
<field name="priority" eval="20"/>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="text_field" on_change="onchange_template_id(100)" readonly="1" />
</field>
</record>
<record id="action3" model="ir.actions.act_window">
<field name="name">Where Use</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.template</field>
<field name="view_type">form</field>
<field name="target">new</field>
<field name="view_id" ref="bom_where_use_form"/>
</record>
<record id="ir_BOM_structure3" model="ir.values">
<field eval="'client_action_multi'" name="key2"/>
<field eval="'product.template'" name="model"/>
<field name="name">Where Use</field>
<field eval="'ir.actions.act_window,'+str(action3)" name="value"/>
</record>
<record id="action4" model="ir.actions.act_window">
<field name="name">Where Use</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.product</field>
<field name="view_type">form</field>
<field name="target">new</field>
<field name="view_id" ref="bom_where_use_form"/>
</record>
<record id="ir_BOM_structure4" model="ir.values">
<field eval="'client_action_multi'" name="key2"/>
<field eval="'product.product'" name="model"/>
<field name="name">Where Use</field>
<field eval="'ir.actions.act_window,'+str(action4)" name="value"/>
</record>
</data>
</openerp>