This question has been flagged
1 Reply
2096 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

Avatar
Discard
Best Answer
  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.
Avatar
Discard