Odoo Help


how to put 2 onchange functions in the same field

on 2/26/14, 1:33 PM 4,284 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

--Axel Mendoza--
| 7 8 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full-time employee trying to understand what to do and how

Reach me at aekroft@gmail.com

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

--Grover Menacho--
| 5 7 8
La Paz, Bolivia
--Grover Menacho--

Odoo Developer

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: 4284 times
Last updated: 12/17/17, 4:18 PM