Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


how to make a button only exist when the user editing the record?

willie ho
on 1/28/15, 9:07 PM 338 views

For some reason, I need to put a button inside the form and make it ONLY exist when the user editing it.

what should I put inside the button?


Atchuthan - Technical Consultant, Sodexis Inc

--Atchuthan - Technical Consultant, Sodexis Inc--
| 5 3 8
Puducherry, India
--Atchuthan - Technical Consultant, Sodexis Inc--
Passionate coder in Python/Odoo(formerly known as OpenERP).

Contact me via GMail: atchuthantu@gmail.com via Skype: atchuthan_skype
via Linkedin: http://in.linkedin.com/in/atchuthantu
Atchuthan - Technical Consultant, Sodexis Inc
On 1/28/15, 11:47 PM

Try using class="oe_edit_only"

<button name="button_dummy"
        states="draft,sent" string="(update)" type="object" class="oe_edit_only oe_link"/>



| 5 3 6
Jakarta, Indonesia
On 1/28/15, 10:28 PM

Try attrs with the following domain: [('id', '>', 0)].  First you need to redefine id column and put it in the form view (with invisible = True if you don't want the field to show).

You can also try to add create="false" as the button's attribute.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 1/28/15, 9:07 PM
Seen: 338 times
Last updated: 3/16/15, 8:10 AM