python - 错误 : "External ID not found in the system" in OpenERP

标签 python xml openerp odoo

尝试安装模块时出现错误。我相信外部 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 文件。定义了“bom_where_use_form”形式,但我不知道为什么它不可见。

<?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>

我想知道缺少什么。

最佳答案

尝试将 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>

关于python - 错误 : "External ID not found in the system" in OpenERP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27547872/

相关文章:

python - 如何合并两个csv文件?

python - AWS Lambda 和 Python 的 .pyc 文件

python - 我可以在 Python 中将两个装饰器组合成一个吗?

c# - 如何使用 C# 将字符串转换为 XML

openerp - 在 TreeView odoo中显示html

python - python中的动态方法生成

python - 如何有效地从 docx/xml 中删除表格并提取文本

c++ - 为什么在两个不同的类中调用 TinyXPath 时,同一对象会给出不同的结果?

python - Odoo 8.0 product_product继承扩展类

openerp - 如何向已在 Odoo 中定义的表单添加标题?