Odoo Help


how to put 2 onchange functions in the same field

on 2/26/14, 1:33 PM 3,754 views

Hi, i would like to put 2 on_changes functions in the same field, and i don't know how to define it in the xml view. Thanks.

Odoo Honduras
On 3/17/16, 10:09 AM

If you need them for math computation try this

@api.onchange('field1', field2')

def onchange_name_of_onchange(self):

if self.field1 or self.field2:

self.fieldresult = self.field1 * self.field2

Edwin Hndez
On 4/1/16, 11:41 PM

+1 Odoo Honduras, thanks

Axel Mendoza
On 3/17/16, 3:05 AM

you can't do it using xml, you need to do it using the new api style for onchange, like:


def onchange_m(self):

self.sex = 'm'


def onchange_f(self):

self.sex = 'f'

Grover Menacho
On 2/26/14, 2:50 PM

There is no way to do it, but there is no need to do 2 onchanges, you can do it once, and return more values, it depends on what you are trying to do.

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

0 follower(s)


Asked: 2/26/14, 1:33 PM
Seen: 3754 times
Last updated: 4/1/16, 11:41 PM