Help

can we hide create/edit button of form view?

Closed
Avatar
jamesbale

The question has been closed for reason: duplicate question

by
Sudhir Arya (ERP Harbor Consulting Services)
on 05/24/2013 04:42:00

Can we hide create/edit button of form view using attrs?

Avatar
Discard
4 Answers
17
Best Answer

Yes you can!

You can remove the Create Button by adding attributes to your form in view.xml file:

<record ...>
    ...
    <form string="NAMEOFFORM" create="false" edit="false" version="7.0">
        ...
    </form>
</record>

This way "Edit" and "Create" are removed from view for all Users.

In case you inherit from an existing view:

    <record>
        ...
        <field name="arch" type="xml">
            <xpath expr='//form[@string="Product"]' position='attributes'>
                <attribute name="create">false</attribute>
            </xpath>
        </field> ,
    </record>
2 Comments
Avatar
Discard
Avatar
Hachem Chraiti
-

im doing like this but the save button does not disable!!!!!!!!!: <record id="view_statistic_cloud_form_methode" model="ir.ui.view"> <field name="name">My First Form view</field> <field name="model">cloud.statistic</field> <field name="type">form</field> <field name="arch" type="xml"> <form string="My First Form View" version="7.0" create="false" > <group col="4"> <field name="meter"/> <field name="Max"/> <field name="Name"/> </group> </form> </field> </record>

Also, with something like this It's possible to hide the buttons from an specific user groups. In this example hide the buttom edit in the Invoice Form. The users of the groups have write privileges only for posting on the messages an communication history but not the fields of the invoices. account.invoice.form account.invoice <xpath expr="//form[@string='Invoice']" position="attributes"> false

7

Hi yes, you can do that ,

you can via access right for specific user

and

in view for all user

like this

   <form create="false" edit="false" >

Thanks
sandeep

3 Comments
Avatar
Discard
Avatar
jamesbale
-

tanks for your help

Avatar
muhammed
-

not working

yes not working

2

This is a duplicate question. See original question: How to remove Save/Edit button

This could also help you: How to remove delete icon in one2many tree view

Avatar
Discard
2

Hello Jamesbale,

You can use create="false" attribute in form tag. It will disable Create button from form view. You can use edit="false" to disable Edit button.

If you want to disable button from form view then use this:

<form create="false" edit="false">

Thanks.

3 Comments
Avatar
Discard
Avatar
Aneesh
-

how to hide the edit button according the status . I want to hide the edit button if status is 'done'

Avatar
Anabela Damas
-

HI @Aneesh do you discover how to hide the button if depending on state and a groups(depending on permissions) ? Thanks

Avatar
Nicolás Mena
-

This actually doesn't work in odoo 11, I don't know if the method to achieve this have changed through versions