odoo - '场地起源不存在'

时间:2023-01-17 15:40:02

This is my code:

这是我的代码:

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

This is to add a new column inside the sales order lines. When updating my module i get the following error:

这是在销售订单行中添加新列。更新我的模块时,我收到以下错误:

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>

Since there is nowhere in my code a reference to a field called origin I have no idea what the exact problem is. Should adding the column be done in a different way or am i overlooking something obvious?

由于我的代码中没有任何地方引用一个名为origin的字段,我不知道确切的问题是什么。应该以不同的方式添加列,还是忽略明显的东西?

edit: This is the xml code where the xpath refers to:

编辑:这是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>

2 个解决方案

#1


3  

I think you need to update few things in xml,

我想你需要在xml中更新一些东西,

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

Because this external id sale.view_order_form is belongs to sale.order model not to sale.order.line model.

因为这个外部id sale.view_order_form属于sale.order模型而不是sale.order.line模型。

#2


0  

This can happen when you have is modified any of the view which is adding some field base don origin or removed the origin field from original record. Originally in database there are total Three views of the sale.order model who is altering or adding the origin view as show below image :

如果您修改了添加某些字段基础源或从原始记录中删除了原始字段的任何视图,则会发生这种情况。最初在数据库中有total.order模型的总共三个视图正在改变或添加原始视图,如下图所示:

odoo  - '场地起源不存在'

  1. sale.order.form is adding the origin field.
  2. sale.order.form正在添加原始字段。
  3. sale.order.inherit is : is inhering view 1 and using origin field added. This will be their only if module sale_crm is installed.
  4. sale.order.inherit是:继承视图1并使用添加的原始字段。这将是他们唯一的安装模块sale_crm。
  5. sale.order.journal.view.form_ : is inhering view 1 and using origin field added. This will be their only if module sale_journal is installed.
  6. sale.order.journal.view.form_:继承视图1并使用添加的原始字段。这将是他们唯一的安装模块sale_journal。

So make sure that this view exist indatabse correctly before upadting your module.

因此,在提升模块之前,请确保此视图正确存在。

Bests

贝斯茨

#1


3  

I think you need to update few things in xml,

我想你需要在xml中更新一些东西,

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

Because this external id sale.view_order_form is belongs to sale.order model not to sale.order.line model.

因为这个外部id sale.view_order_form属于sale.order模型而不是sale.order.line模型。

#2


0  

This can happen when you have is modified any of the view which is adding some field base don origin or removed the origin field from original record. Originally in database there are total Three views of the sale.order model who is altering or adding the origin view as show below image :

如果您修改了添加某些字段基础源或从原始记录中删除了原始字段的任何视图,则会发生这种情况。最初在数据库中有total.order模型的总共三个视图正在改变或添加原始视图,如下图所示:

odoo  - '场地起源不存在'

  1. sale.order.form is adding the origin field.
  2. sale.order.form正在添加原始字段。
  3. sale.order.inherit is : is inhering view 1 and using origin field added. This will be their only if module sale_crm is installed.
  4. sale.order.inherit是:继承视图1并使用添加的原始字段。这将是他们唯一的安装模块sale_crm。
  5. sale.order.journal.view.form_ : is inhering view 1 and using origin field added. This will be their only if module sale_journal is installed.
  6. sale.order.journal.view.form_:继承视图1并使用添加的原始字段。这将是他们唯一的安装模块sale_journal。

So make sure that this view exist indatabse correctly before upadting your module.

因此,在提升模块之前,请确保此视图正确存在。

Bests

贝斯茨