python - 字段未显示在 product.template odoo8 中

标签 python css xml odoo

我做错了什么?我在这张图片中有一张图片标题 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>

enter image description here

希望对你有所帮助。

关于python - 字段未显示在 product.template odoo8 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51100276/

相关文章:

python - 如何通过 mod-wsgi 使用 FCKEditor 的图像上传和浏览器?

python - 特拉维斯 CI : Switch to python 3 temporarily

html - Bootstrap2 容器最大宽度

javascript - 将日期标签添加到 HighCharts 折线图

python - 两个 numpy 数组的逐元素减法

html - 为什么 img 可点击空间包含整个 div?

html - .img-responsive Bootstrap 问题响应设计。图像停留在 25% 宽度

c# - 使用自定义 IXmlSerializer 反序列化注释

php - UPS 运输 API - ShipmentConfirmRequest 错误

python - Django - 格式化/访问模板中的 Pandas.to_dict() 数据框