Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Can we override default form controls?

Julian Solorzano
on 9/15/14, 2:25 PM 862 views

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)

One can override default widget, No doubt ... but am not sure whether you can achieve for input data... Alternate option, use Onchange Event...

on 9/16/14, 1:12 AM

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.

Zenpar S.A. de C.V., Julian Solorzano
on 9/16/14, 1:17 AM

Solanki Shamji

--Solanki Shamji--
| 5 2 6
Baroda, India
--Solanki Shamji--


Solanki Shamji
On 9/16/14, 5:54 AM


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.







| 5 3 6
Jakarta, Indonesia
On 9/16/14, 5:22 AM

Julian, yes you can override FieldChar for that purpose.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)


Asked: 9/15/14, 2:25 PM
Seen: 862 times
Last updated: 3/16/15, 8:10 AM