我做错了什么?我在这张图片中有一张图片标题 250g Lays Pickels 在这个标题之后我想显示 internal reference 字段。您可以在这张图片右侧看到内部引用 字段。请看一下这张图片样本/image/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>
希望对你有所帮助。
关于python - 字段未显示在 product.template odoo8 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51100276/