Odoo Help

0

Hide button in workflow

By
Trai Doan
on 11/22/14, 8:36 AM 698 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

  http://upanh.biz/images/2014/11/22/12345.jpg

0
Ivan
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.

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 11/22/14, 8:36 AM
Seen: 698 times
Last updated: 3/16/15, 8:10 AM