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.


Hide button in workflow

Trai Doan
on 11/22/14, 8:36 AM 511 views

I have workflow with 4 states : new ,negotiation,won,lost and a button . I want my button only  visible in state won and invisible in other state .

Here my code

    <button string="Nhập kho" name="themkho" type="object" attrs="{'invisible': [('state','in',['new','negotiation','lost'])]}"/>

1 - How can i hide my button when i create new view  ? 

2- How can i use my button only 1 time and afterthat it will invisible for all state ?

3- How can hide edit button in state negotiation,won and lost ?

Sorry , i don't have enough  karma to post image




| 5 3 6
Jakarta, Indonesia
On 11/24/14, 5:03 AM
  1. Set the state to be 'draft' when creating a new record using _default and then you can use that in attrs.
  2. You can add a boolean (other field also possible but boolean is the easiest) field and set the value to True when the button is clicked.  Then the button is invisible if the field's value is True.  The field need to be added to the view, altough it can be invisible. Or you can use the reverse value (False) if it is more appropriate, but don't forget to set the _default of that field.
  3. You don't usually hide the edit button, but you make the fields to be readonly on specific states.

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: 11/22/14, 8:36 AM
Seen: 511 times
Last updated: 3/16/15, 8:10 AM