首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >odoo -“原野不存在”

odoo -“原野不存在”
EN

Stack Overflow用户
提问于 2015-08-01 14:07:56
回答 2查看 2.6K关注 0票数 3

这是我的密码:

代码语言:javascript
复制
   <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>

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

代码语言:javascript
复制
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>

由于我的代码中没有引用一个名为原产地的字段,所以我不知道确切的问题是什么。应该以不同的方式添加列,还是我忽略了一些显而易见的内容?

编辑:这是xpath引用的xml代码:

代码语言:javascript
复制
<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>
EN

回答 2

Stack Overflow用户

发布于 2015-08-03 04:49:16

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

代码语言:javascript
复制
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="priority" eval="50" />

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

票数 3
EN

Stack Overflow用户

发布于 2015-08-01 23:39:54

这可能发生在您已经修改了任何视图时,该视图添加了一些字段基don原产地,或者从原始记录中删除了源文件字段。在数据库中,sale.order模型共有三个视图,它们正在更改或添加原始视图,如下图所示:

  1. sale.order.form正在添加源字段。
  2. sale.order.inherit是:正在继承视图1并使用源文件字段添加。如果安装了模块sale_crm,这将是它们唯一的选择。
  3. sale.order.journal.view.form_:是继承视图1并使用源字段添加的。如果安装了模块sale_journal,这将是它们唯一的选择。

因此,在打开模块之前,请确保此视图在数据库中正确存在。

凌驾

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31762754

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档