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.


how to on_change

Abdullah Sofan
on 11/19/14, 5:01 AM 318 views

Can someone provide a simple example of how to use on_change ?

I want that when a user changes the value of many2one field, the on_change method would fetch values of the parent object and populate other fields with them.

I areally appreciate your help.




| 5 4 8
Kochi, India
ODOO technical and functional

        I like learning new thing, especially technical thing. I am a quick learner, I can learn technical things very fast. I have good logical skill,  I have immense interest in programming.

e-mail id : baijuks@hotmail.com

On 11/19/14, 6:16 AM

Hi Abdullah,

   First of all you decide the field to give on-change then add on_change attribute to that field

<field name="demo_field" on_change="onchange_demo_field(arguments)"/>


Then define onchange function in .py file:-

def onchange_demo_field(self, cr, uid, ids, product_id, product_qty=0, context=None):
        res = {}

        function body
        return res


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

1 follower(s)


Asked: 11/19/14, 5:01 AM
Seen: 318 times
Last updated: 3/16/15, 8:10 AM