Odoo Help


Whether onchange() function in odoo 8 requires classical arguments (cr,uid,ids...) ?

Deepak Krishna
on 10/20/15, 3:00 AM 1,084 views


def get_onchange(self):

        if self.r_sale:


                   print obj.id

This function showing Error : "  get_onchange() takes exactly 1 argument (5 given)".

This is how i defined on_change in view :<field name="r_sale" on_change="get_onchange(r_sale)"/>

What are the 5 arguments passed to the function get_onchange()? Why it shows error?

Akhil P Sivan
On 10/20/15, 3:15 AM

You don't need to use on_change attribute in view definition for v8. And also in browse() you need to pass list of id/ids.

Try like this:


def _get_onchange(self):

if self.r_sale:


print obj.id

in view:

<field name="r_sale" />;

Thank You

Deepak Krishna
on 10/20/15, 4:08 AM

Hello Deepak Krishna,

If you are using api.onchange, then you don't have to specify the onchange in your xml.

Just remove the "on_change" (on_change="get_onchange(r_sale)") attribute from xml, update the module and try that again.

Hope this will help you.

Thank You

Deepak Krishna
on 10/20/15, 4:09 AM
Karthik Arumugam
On 10/20/15, 3:14 AM

Hi Depak

You need not to specify on_change="get_onchange(r_sale)"/> in your view definiton.

I think this may be the problem.

Thank You

Deepak Krishna
on 10/20/15, 4:08 AM

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 10/20/15, 3:00 AM
Seen: 1084 times
Last updated: 10/22/15, 1:17 PM