Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
4499 Lượt xem

Exactly as what the title said,


because invisible attribute is not always the case

there are some scenarios from UI and/or UX perspectives where enabling or disabling buttons are much better and more likeable than showing or hiding them

I hope that it can be considered in the future, or sooner
Thanks in advance

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi Faris:


"disabled" attribute on button will result in a serious security problem:  it can be removed manually in the browser's develop tool and the button will be re-enabled.  So does the "readonly" attribute on button.  I think that's why odoo framework does not provide the 'disabled' .

So my opinion better not use 'disabled' or 'readonly' on button.  Attribute “Invisible” on button is safe, it will not render the element onto the browser.  

You can try create 2 same buttons but one is visible while the other is not:

<button name="mybutton" type="object" title="Text on button" icon="fa-pencil" attrs="{'invisible': [('condition','=',False)]}"/>
<button name="" type="" title="Text on button" icon="fa-pencil" attrs="{'invisible': [('condition','!=',False)]}"/>



Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello, @Faris Fathurrahman

Hope you are doing well,

xml attribute : disabled="disabled"

Please find code in comment.

I hope this will help you.

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

Ảnh đại diện
Huỷ bỏ

<button name="customer_report" position="attributes">
<attribute name="disabled">disabled</attribute>
</button>
OR
<button name="customer_report" position="attributes">
<attribute name="class">disabled</attribute>
</button>

Dear Odoo, Can You Please Add "disabled" Attribute?
https://www.odoo.com

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 24
5877
1
thg 4 17
3816
1
thg 10 22
9700
3
thg 1 18
8077
1
thg 3 15
12070