Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
5724 Vizualizări

Hello,

I have an one2many field with a list view and I have added 4 buttons to the list view as in the attached image.

These buttons display according to the state field. The problem that I face is that each button is displayed as a column and as a result of this the view is a bit messy. What I need is

  • Disable buttons according to the state (read only) or

  • Display all buttons in one column.

  • Or another way to make the view nice

How can I achieve any of these options?

Thanks. 




Imagine profil
Abandonează

Hi, You can't have more than one button in one column but what you can do is using one button with type object which call a method and in this method you will write your code which do what you want to do depend on state method. To change the label of button based on State of record you will use fields_view_get()

Cel mai bun răspuns

Hello Eshan Harshana,

Please find below code, It may be helpful for you.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Imagine profil
Abandonează

<button name="button_create_job" type="object" string="Start" class="btn-success" style="width: 50px;" attrs="{'invisible': [('state', '=', 'done')]}"/>
<button name="button_create_job" type="object" string="Start" class="btn-success" style="width: 50px;visibility: hidden;" attrs="{'invisible': [('state', '=', 'scheduled')]}"/>

<button name="button_done" type="object" string="Pause" class="btn-success" style="width: 50px;" attrs="{'invisible': [('state', '=', 'done')]}"/>
<button name="button_done" type="object" string="Pause" class="btn-success" style="width: 50px;visibility: hidden;" attrs="{'invisible': [('state', '=', 'scheduled')]}"/>

<button name="button_complete" type="object" string="Done" style="width: 50px;" class="btn-success"/>

<button name="button_cancel" type="object" string="Cancel" class="btn-warning" style="width: 50px;" attrs="{'invisible': [('state', '=', 'done')]}"/>
<button name="button_cancel" type="object" string="Cancel" class="btn-warning" style="width: 50px;visibility: hidden;" attrs="{'invisible': [('state', '=', 'scheduled')]}"/>

Related Posts Răspunsuri Vizualizări Activitate
2
sept. 21
10783
6
oct. 24
49802
4
dec. 23
78510
1
sept. 18
10527
1
sept. 17
4506