SlideShare a Scribd company logo
How Update Client Interface ‘on change’
@api.onchange Odoo 16
● Odoo api.onchange decorator is used to invoke a method
when a field’s value changed.
● It can be used to validate the data or to trigger an action. A
detailed explanation of the technical and functional aspects
of the Onchange mechanical of Odoo.
● Furthermore, an insight into the Odoo api.onchange
decorator operations which are used to invoke a method
when a field’s value changed in the platform.
api.onchange
● The function of the decorator will be called when the field
value changes.
● Moreover, it supports only single field names; on the
contrary, dotted names will not be considered.
● Furthermore, onchange methods are invoked on pseudo-
records that contain values of the form.
Onchange
● @api.onchange “decorator will trigger the call to the decorated
function if any of the fields specified in the decorator is changed
in the form”.
● In previous sample self corresponds to the record currently
edited on the form. When in onchange context all work is done in
the cache.
Onchange
● Changing the user field the email field will change accordingly.
When we define the menu,sub-menus, and action for the
corresponding model.This is the main menu we created for
Customer Details.
Here we have sub-menu Reports and Customer Details Report.
In the developer mode, Go to>Settings>Technical>User Interface>Menu
Items
Go to > Menu Items > Create
● Menu - Name of the menu
● Parent Menu - Parent menu if any
● Sequence - sequence in which the menu has to appear.
● Action - we have to choose ir.action.act_window so that another
field appears in which we can choose the respective action that
has to be called on clicking the menu. In this example, I will give
the action only for the sub-menu.
● Access Rights - If we need to give access only to a particular
user group, we can add access rights.
● Submenus- If we need to add a sub-menu for the menu, we can
add it here,
Here we have added a sub-menu,
Here appears the Sales menu and Sales sub-menu in the Sales
module.
Check our company website
for related blogs and Odoo book.
Check our YouTube channel for
functional and technical videos in Odoo.

More Related Content

Onchange

  • 1. How Update Client Interface ‘on change’ @api.onchange Odoo 16
  • 2. ● Odoo api.onchange decorator is used to invoke a method when a field’s value changed. ● It can be used to validate the data or to trigger an action. A detailed explanation of the technical and functional aspects of the Onchange mechanical of Odoo. ● Furthermore, an insight into the Odoo api.onchange decorator operations which are used to invoke a method when a field’s value changed in the platform.
  • 3. api.onchange ● The function of the decorator will be called when the field value changes. ● Moreover, it supports only single field names; on the contrary, dotted names will not be considered. ● Furthermore, onchange methods are invoked on pseudo- records that contain values of the form.
  • 5. ● @api.onchange “decorator will trigger the call to the decorated function if any of the fields specified in the decorator is changed in the form”. ● In previous sample self corresponds to the record currently edited on the form. When in onchange context all work is done in the cache.
  • 7. ● Changing the user field the email field will change accordingly.
  • 8. When we define the menu,sub-menus, and action for the corresponding model.This is the main menu we created for Customer Details.
  • 9. Here we have sub-menu Reports and Customer Details Report.
  • 10. In the developer mode, Go to>Settings>Technical>User Interface>Menu Items
  • 11. Go to > Menu Items > Create
  • 12. ● Menu - Name of the menu ● Parent Menu - Parent menu if any ● Sequence - sequence in which the menu has to appear. ● Action - we have to choose ir.action.act_window so that another field appears in which we can choose the respective action that has to be called on clicking the menu. In this example, I will give the action only for the sub-menu. ● Access Rights - If we need to give access only to a particular user group, we can add access rights. ● Submenus- If we need to add a sub-menu for the menu, we can add it here,
  • 13. Here we have added a sub-menu,
  • 14. Here appears the Sales menu and Sales sub-menu in the Sales module.
  • 15. Check our company website for related blogs and Odoo book. Check our YouTube channel for functional and technical videos in Odoo.