我继承了一个购买模块,但我不想要字段"incoterm_id",我试图使用 xpath 和属性隐藏它,不幸的是它根本没有隐藏。 这是我的代码。
<record id="view_construction_form" model= "ir.ui.view">
<field name="name">view.construction.form</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml">
<form>
<xpath expr="/form/sheet/notebook/page[2]/group[1]/group[1]/field[@name='incoterm_id']" position="attributes">
<attribute name="invisible">True</attribute>
</xpath>
</form>
</field>
</record>
尝试使用以下代码:
<field name="incoterm_id" position="attributes">
<attribute name="invisible">1</attribute>
</field>
确保在 __ 清单 __.py 文件中列出了视图文件。
之后重新启动您的Odoo服务器并升级您的模块。