Skip to Content
Menu
This question has been flagged
2 Replies
2453 Views

i want to hide button create

Avatar
Discard
Best Answer

Hello,

In settings >> access rights, You can remove the create access for particular group/user.

shivoham.odoo@gmail.com

Avatar
Discard
Best Answer

You can hide create button in res partner from all users by overriding the form, kanban and tree view as below:

<!-- Hide create button from Kanban View -->
<record id="res_partner_kanban_view_hide_create" model="ir.ui.view">
<field name="name">res.partner.kanban.inherit.hide.create</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.res_partner_kanban_view"/>
<field name="arch" type="xml">
<xpath expr="//kanban" position="attributes">
<attribute name="create">0</attribute>
</xpath>
</field>
</record>



<!-- Hide create button from Tree View -->
<record id="res_partner_view_tree_inherit_hide_create" model="ir.ui.view">
<field name="name">res.partner.view.tree.inherit.hide.create</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_tree"/>
<field name="arch" type="xml">
<xpath expr="//tree" position="attributes">
<attribute name="create">0</attribute>
</xpath>
</field>
</record>





<!-- Hide create button from Form View -->
<record id="view_partner_form_inherit_hide_create" model="ir.ui.view">
<field name="name">res.partner.view.form.inherit.hide.create</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//form" position="attributes">
<attribute name="create">0</attribute>
</xpath>
</field>
</record>

Avatar
Discard
Author

thank you bro but i can with security ???

You can create your own group and then add the group to the above override view so any user in this group will not able to see the create button.

Create security group:
<record id="group_hide_partner_create_button" model="res.groups">
<field name="name">Hide Partner Create Button</field>
</record>

Then add the groups to all above overidded views, for example the form view:
<record id="view_partner_form_inherit_hide_create" model="ir.ui.view">
<field name="name">res.partner.view.form.inherit.hide.create</field>
<field name="model">res.partner</field>
<field name="groups_id"
eval="[(4,ref('[YOUR_CUSTOM_MODEUL_NAME].group_hide_partner_create_button'))]"/>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//form" position="attributes">
<attribute name="create">0</attribute>
</xpath>
</field>
</record>

Author

thnak you

Author

please its possible to hide button create with file ir.model.access.csv ??
exemple:
access_res_partner_user,_es_partner_user,base.model_res_partner,YOUR_CUSTOM_MODEUL_NAME.group_hide_partner_create_button,1,0,0,0

Yes, you can remove the create access from Access Rights in Settings after enabling developer mode

Related Posts Replies Views Activity
3
Apr 24
994
0
May 24
46
1
Apr 24
1822
4
Sep 23
3074
2
Sep 23
5592