跳至內容
選單
此問題已被標幟
3 回覆
22621 瀏覽次數

need to remove first empty element from selection drop down list.and one is selected default.please advice me to do that friends..

selection field

its comes like

Gender
-----------------------------
|                         |v|
-----------------------------
EMPTY ELEMENT
-----------------------------
Male
-----------------------------
Female
-----------------------------
頭像
捨棄
最佳答案

Or we can make this field required to remove the blank value

with required="1"

頭像
捨棄
最佳答案

We can remove empty option by adding an attribute to the field that is required='True'.

i.e

inventory_availability = fields.Selection([
('never', 'Sell regardless of inventory'),
('custom', 'Show product-specific notifications'),
], string='Inventory Availability', default='never', required=True)


頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
2
12月 23
12358
2
6月 21
18194
0
9月 20
3513
0
5月 16
3881
1
8月 15
9310