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

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
-----------------------------
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

with required="1"

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

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)


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 12 23
12747
2
thg 6 21
18573
0
thg 9 20
3725
0
thg 5 16
4135
1
thg 8 15
9609