【问题标题】:Element not found in parent view (ODOO 12)在父视图中找不到元素 (ODOO 12)
【发布时间】:2020-03-06 12:16:50
【问题描述】:

我正在开发 odoo 12 (python 3.6),我正在尝试从 product.template 继承并隐藏条形码字段,但我遇到了这个错误:

element'<xpath expr="//field[@name='barcode']">' not found in parent view

这是我的 gesimmo_views.xml

<odoo>
    <record model="ir.ui.view" id="view_form_gesimmo">
      <field name="name">Product</field>
      <field name="model">product.template</field>
        <field name="inherit_id" ref="product.product_template_form_view"/>
      <field name="arch" type="xml">
          <xpath expr="//field[@name='standard_price']" position="after">
              <group>
              <field name="surface"/>
                  <!--<field name="refimmo"/>!-->
              </group>
          </xpath>
          <xpath expr="//field[@name='barcode']" position="attributes">
             <attribute name="invisible">1</attribute>
      </xpath>
      </field>
    </record>
</odoo>

请帮忙!

【问题讨论】:

    标签: python xml python-3.6 odoo odoo-12


    【解决方案1】:

    您应用了错误的参考。只需更改对这个 product.product_template_only_form_view 的引用

    谢谢

    【讨论】:

    • 它与另一个字段(standard_price)一起使用,但我在使标签不可见时遇到问题,请您帮帮我
    • @Hello_world 您只需在该字段上添加 nolabel="1" 即可。
    • 问题解决了,我尝试了这个解决方案,它成功了 1 但现在我有一个 Many2many 字段的问题,我想让它不可见……你能帮我吗?
    • 字段:product.template 中的 tax_id
    • @Hello_world 使用此 id = 'product_template_form_view' 继承然后将 XPath 添加到同一字段 ['taxes_id'] 以设置不可见
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-03
    • 2019-11-16
    • 2011-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多