Enable Dark Mode!
By: Cirin C Baby

How to Add Onchange Function from User Interface in Odoo?

Technical Odoo 14

In this blog, I am going to explain Onchange function creation from User Interface. The onchange function can be created easily with help of onchange () decorator in the code. Most people are not aware of how to add an onchange function from the user interface. This functionality is available in the community and enterprise editions of odoo. Let's check how to add an onchange function from the user interface.

First, we have to enable debug mode.

Then General Settings -> Technical -> Automated Actions


If this menu is not listed in your database install the module “base_automation”.


This is the interface of automating action creation.


Now we can create an onchange function as in the below-given screenshot while creating a new individual contact. Based on the Related Company field we are creating an onchange function for updating the  Company details such as Mobile, Email, and Website Link.


Here when we select the parent company, only the corresponding company address details are automatically shown.


The parent company also has these details. Now we are going to create an onchange function for getting the details marked in the above screenshot.


In the above screenshot, we have created an onchange function.

1. Action Name: Specify a name for the action.

2. Model: Choose the model inside which you need the onchange function.

3. Trigger: Set Based on Form Modification.

4. Trigger Fields: Select field for onchange.

5. Apply on: We can filter data with conditions. Onchange gets applied only on the filtered records.

6. Action To Do: Select  Update the Record.

7. Data To Write:

a)Field: Select the field which is to be updated.

b)Evaluation Type: Select Python Expression

c)Value: Give field details, which value you need to set.

For example:



For a reference, check the screenshot below



In the below screenshot, We got the values fetched using the onChange() function from the user interface.


If you need any assistance in odoo, we are online, please chat with us.

cybrosys youtube


Leave a comment


Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635


Cybrosys Limited
Alpha House,
100 Borough High Street, London,
SE1 1LB, United Kingdom


Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.


Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message