(odoo 10)I tried to create a primary form that inherits the vendor bills form to hide the field 'purchase_id'.
The problem is that the system raised error saying the field was not found in the parent.
The field 'purchase_id' is originally in an extension view of the parent. I tried inheriting from the parent and the extension but both doesn't work. Can anyone help?
Here is the code:
<record id="view_coop_member_sell_share_vendor_bill_form" model="ir.ui.view">
<field name="name">coop.member.sell.share.vendor.bill.form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_supplier_form" />
<field name="mode">primary</field>
<field eval="20" name="priority"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='purchase_id']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
....
Here is the parent:
<record id="invoice_supplier_form" model="ir.ui.view">
<field name="name">account.invoice.supplier.form</field>
<field name="model">account.invoice</field>
<field name="priority">2</field>
<field name="arch" type="xml">
<form string="Vendor Bill">
<header>
...
Here is the extension where the 'purchase_id' is
<ecordid="view_invoice_supplier_purchase_form"model="ir.ui.view">
<field name="name">account.invoice.supplier.purchase</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_supplier_form"/>
<field name="arch" type="xml">
<field name="reference" position="after" >
<field name="purchase_id" attrs="{'invisible': [('state', '=', 'purchase')]}" class="oe_edit_only"
options="{'no_create': True}"/>
</field>
....