Skip to Content
Menu
This question has been flagged
3 Replies
2771 Views

i want to change some options of the field user_id in a purchase order but the following xml/xpath does not seem to work:

        <record model="ir.ui.view" id="purchase_order_extended_form">
            <field name="name">purchase.purchase_order_extended_form</field>
            <field name="model">purchase.order</field>
            <field name="inherit_id" ref="purchase.purchase_order_form" />
            <field name="arch" type="xml">
           
                <xpath expr="//field[@name='user_id']" position="attributes">
                        <attribute name="options">{'no_open': True,'no_create': True,'no_quick_create':True,'no_create_edit':True}</attribute>
                </xpath>
            </field>
        </record>


please give any hints whats wrong. i just want to remove the "Open" Icon next to the many2one field.

this


Avatar
Discard

make sure you have register this xml file into the __manifest__.py file.

Best Answer
hope this helps

<record model="ir.ui.view" id="purchase_order_extended_form">
<field name="name">purchase.purchase_order_extended_form</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml">
<field name='user_id' position='replace'>
<field name="user_id" options="{'no_create': True, 'no_open': True}"/>
</field>
</field>
</record>
Avatar
Discard
Author

it still shows the icon next to the field. it seems to ignore this options for the user_id field. for other fields it with the options attribute but not for user_id

Author Best Answer

@Mitul Shingala: the xml is in the manifest. there are many other definitions within same file that work. only the user_id does not work

Avatar
Discard