I know that we can create new javascript modules with new widgets, but is there a way to replace functionality of the already existing default form controls? Say, if I wanted that all text fields in the system automatically converted their input to uppercase, could I do this by extending FieldChar? (and not having to modify the actual views in the system, just that my new code overrided the default field)
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,
You can also use python code for this,
_inherit = 'dummy.dummy'
_columns =
{
'dummy_field': fields.char('Dummy', size=80, select=True, required=True)
}
def onchange_case(self, cr, uid, ids, dummy_field, context=None):
result = {
'value': { 'dummy_field': str(dummy_field).upper() }
}
return result
And call oncahnge function in xml.
Thanks.
Julian, yes you can override FieldChar for that purpose.
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 | |
---|---|---|---|---|
|
0
thg 8 25
|
2560 | ||
|
0
thg 8 20
|
3290 | ||
|
0
thg 2 18
|
3540 | ||
|
0
thg 9 17
|
4384 | ||
|
2
thg 11 15
|
859 |
One can override default widget, No doubt ... but am not sure whether you can achieve for input data... Alternate option, use Onchange Event...
Thanks! Yes, it can be done with the onchange event, but the problem is that if I wanted to affect every single field in the system, I would have to extend every single view to add the "onchange" attribute in every single field. Not really an option.