i have a radio widget, i wanted it as a required field but the `required=True` is not working here..
any solution for this?
vendor_from = fields.Selection([('user', 'User'), ('vendor', 'Vendor')], string="Vendor From")
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
Hello Ashutosh
`required=True` should work here in python field declaration.
Alternatively, you can write `required='"1"` in XML file for that field. Try this one it will solve your issue.
Thank you!
thank you :)
Hi,
The required parameter works with the fields when you add it in python field definition or XML code. But, it doesn't work when we use a radio widget for the selection field. If you need to make it required, then you have to provide a default value in the definition. Once you give a default value, it will be there and the only option for the user will be to change it and there will be no option to remove it like the normal dropdown option. Hence the field can be used as a required field.
For example:
vendor_from = fields.Selection([('user', 'User'), ('vendor', 'Vendor')],
string="Vendor From", default='user')
Regards
thank you :)
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
1
thg 6 25
|
1690 | ||
|
3
thg 7 25
|
3318 | ||
|
1
thg 5 25
|
1456 | ||
|
1
thg 5 25
|
1722 | ||
|
4
thg 5 25
|
2863 |