product.template odoo8 中未显示字段
Field is not showing in product.template odoo8
我做错了什么?我在这个图片标题 250g Lays Pickels 中有一张图片,在这个标题之后我想显示 internal reference 字段。你可以在这张图片右侧看到内部参考 field.please 看看这张图片样本https://i.stack.imgur.com/xHKsd.png
这是*xml文件
<openerp>
<data>
<record id="product_template_form_view" model="ir.ui.view">
<field name="name">product.template.form.view</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//div[@class='oe_title']/h1" position="after">
<label class="oe_edit_only" for="default_code" string="Internal reference"/>
<field name="default_code" class="oe_inline"/>
</xpath>
</field>
</record>
</data>
</openerp>
这是*python文件
from openerp.osv import fields, osv
class product_template(osv.osv):
_inherit = 'product.template'
_columns = {
'default_code': fields.char('Internal Reference', select=True),
}
试试下面的代码,
<record id="product_template_only_form_view" model="ir.ui.view">
<field name="name">product.template.form.view</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='default_code']" position="replace"/>
<xpath expr="//div[@class='oe_title']/h1" position="after">
<label class="oe_edit_only" for="default_code" string="Internal Reference"/>
<field name="default_code" class="oe_inline"/>
</xpath>
</field>
</record>
希望对您有所帮助。
我做错了什么?我在这个图片标题 250g Lays Pickels 中有一张图片,在这个标题之后我想显示 internal reference 字段。你可以在这张图片右侧看到内部参考 field.please 看看这张图片样本https://i.stack.imgur.com/xHKsd.png
这是*xml文件
<openerp>
<data>
<record id="product_template_form_view" model="ir.ui.view">
<field name="name">product.template.form.view</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//div[@class='oe_title']/h1" position="after">
<label class="oe_edit_only" for="default_code" string="Internal reference"/>
<field name="default_code" class="oe_inline"/>
</xpath>
</field>
</record>
</data>
</openerp>
这是*python文件
from openerp.osv import fields, osv
class product_template(osv.osv):
_inherit = 'product.template'
_columns = {
'default_code': fields.char('Internal Reference', select=True),
}
试试下面的代码,
<record id="product_template_only_form_view" model="ir.ui.view">
<field name="name">product.template.form.view</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='default_code']" position="replace"/>
<xpath expr="//div[@class='oe_title']/h1" position="after">
<label class="oe_edit_only" for="default_code" string="Internal Reference"/>
<field name="default_code" class="oe_inline"/>
</xpath>
</field>
</record>
希望对您有所帮助。