Xml 奥多';字段原点不存在';

Xml 奥多';字段原点不存在';,xml,odoo,odoo-8,Xml,Odoo,Odoo 8,这是我的代码: <record id="view_order_form_inline" model="ir.ui.view"> <field name="model">sale.order.line</field> <field name="inherit_id" ref="sale.view_order_form"/> <field name="arch" typ

这是我的代码:

   <record id="view_order_form_inline" model="ir.ui.view">
            <field name="model">sale.order.line</field>
            <field name="inherit_id" ref="sale.view_order_form"/>
            <field name="arch" type="xml">
                <xpath expr="//field[@name='order_line']/tree/field[11]" position="after">
                    <field name="xx_insurance_inline"/>
                </xpath>
            </field>
        </record>

销售订单
这是为了在销售订单行中添加一个新列。 更新模块时,我遇到以下错误:

ParseError: "ValidateError
Field(s) `arch` failed against a constraint: Invalid view definition

Error details:
Field `origin` does not exist

Error context:
View `sale.order.line form`
[view_id: 1035, xml_id: n/a, model: sale.order.line, parent_id: 647]" while parsing /home/pantera/Custom/xx_khleuven2/view/sale.xml:24, near
<record id="view_order_form_inline" model="ir.ui.view">
            <field name="model">sale.order.line</field>
            <field name="inherit_id" ref="sale.view_order_form"/>
            <field name="arch" type="xml">
                <xpath expr="//field[@name='order_line']/tree/field[11]" position="after">
                    <field name="xx_insurance_inline"/>
                </xpath>
            </field>
        </record>
ParseError:“ValidateError”
字段'arch'针对约束失败:视图定义无效
错误详细信息:
“来源”字段不存在
错误上下文:
查看'sale.order.line表单'`
[view_id:1035,xml_id:n/a,model:sale.order.line,parent_id:647]”解析/home/pantera/Custom/xx_khlueven2/view/sale.xml:24,near
销售订单
因为在我的代码中没有对名为origin的字段的引用,所以我不知道确切的问题是什么。 是否应该以不同的方式添加列,还是我忽略了一些明显的内容

编辑: 这是xpath所指的xml代码:

<field name="order_line">
    <form string="Sales Order Lines">
    ....
    </form>
    <tree string="Sales Order Lines" editable="bottom">
         <field name="sequence" widget="handle"/>
         <field name="state" invisible="1"/>
         <field name="th_weight" invisible="1"/>
         <field name="product_id"
                                        context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom}"
                                        groups="base.group_user"
                                        on_change="product_id_change(parent.pricelist_id, product_id, product_uom_qty, False, product_uos_qty, False, name, parent.partner_id, False, True, parent.date_order, False, parent.fiscal_position, False, context)"/>
               <field name="name"/>
               <field name="product_uom_qty"
                                        context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom}"
                                        on_change="product_id_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, product_uos_qty, product_uos, name, parent.partner_id, False, False, parent.date_order, False, parent.fiscal_position, True, context)"/>
                <field name="product_uom"
                                        on_change="product_uom_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, product_uos_qty, product_uos, name, parent.partner_id, False, False, parent.date_order, context)"
                                        groups="product.group_uom" options='{"no_open": True}'/>
               <field name="product_uos_qty" groups="product.group_uos" invisible="1"/>
               <field name="product_uos" string="UoS" groups="product.group_uos" invisible="1"/>
               <field name="price_unit"/>
               <field name="tax_id" widget="many2many_tags" domain="[('parent_id','=',False),('type_tax_use','&lt;&gt;','purchase')]"/>
               <field name="discount" groups="sale.group_discount_per_so_line"/>
               <field name="price_subtotal"/>
       </tree>
  </field>

....

当您修改了在原始记录中添加一些字段基的视图或从原始记录中删除了原始记录中的字段时,可能会发生这种情况。最初在数据库中,共有三个视图显示正在更改或添加原始视图的sale.order模型,如下图所示:

  • sale.order.form正在添加来源字段
  • sale.order.inheritis:is正在查看1,并使用添加的origin字段。只有安装了模块sale\u crm,这才是他们的目标
  • sale.order.journal.view.form:在自己的视图1中并使用添加的来源字段。只有安装了模块销售日记帐,这才是他们的目标
  • 因此,在升级模块之前,请确保此视图在数据库中正确存在


    Bests

    我认为您需要用xml更新一些东西

    <field name="model">sale.order</field>
    <field name="inherit_id" ref="sale.view_order_form"/>
    <field name="priority" eval="50" />
    
    sale.order
    

    因为此外部id
    sale.view\u order\u form
    属于sale.order模型而不是sale.order.line模型。

    您解决了这个问题吗?我也有同样的问题。