Hi,
I've tried many different approaches, but I just can't find a way to xpath to these buttons on res.partner.form :
I've used the browsers HTML inspector (F12) to find the name of the buttons, but maybe thats not the correct way
How can I make those buttons visible only to administrators?
My code:
<record id="edit_partner_form" model="ir.ui.view"> <field name="name">edit.partner.form</field> <field name="model">res.partner</field> <field name="inherit_id" ref="base.view_partner_form" /> <field name="arch" type="xml"> <xpath expr="//button[@name='action_view_partner_invoices']" position="attributes"> <attribute name="groups">base.group_system</attribute> </xpath>
<xpath expr="//button[@name='302']" position="attributes"> <attribute name="groups">base.group_system</attribute> </xpath> </field> </record>
Edit: Just found out the solution! To anyone who has the same issue in the future, there are 2 external IDs, one for each button:
<record id="edit_sales_hide_invoice_button" model="ir.ui.view">
<field name="name">edit.partner.form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="account.partner_view_buttons" />
<field name="arch" type="xml">
<xpath expr="//button[@name='action_view_partner_invoices']" position="attributes">
<attribute name="groups">base.group_system</attribute>
</xpath>
</field>
</record>
<record id="edit_sales_hide_sale_button" model="ir.ui.view">
<field name="name">edit.partner.form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="sale.res_partner_view_buttons" />
<field name="arch" type="xml">
<xpath expr="//button[@name='302']" position="attributes">
<attribute name="groups">base.group_system</attribute>
</xpath>
</field>
</record>