Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
23026 มุมมอง

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)


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ธ.ค. 23
12680
2
มิ.ย. 21
18469
0
ก.ย. 20
3698
0
พ.ค. 16
4098
1
ส.ค. 15
9543