Differences between Patching and Extending components in
Odoo 17
Enterprise
Introduction
Enterprise
OWL, odoo’s frontend framework is a robust and extensive tool
used by odoo developers for making frontend
modification/customization. Here we are going to see the purpose
and difference between patching and extending a component .
Steps
Enterprise
1. Patching
Patching is mainly used to override or add functions to a
component .
a. Override existing function
i. To override existing function just call the function,
call the super method and then add in the required
code
Example
Enterprise
Let us see an example. I am going to modify the Pos item list so that a
dialog box saying input block appears whenever we try to add a product
and hence will prevent users from adding in the product .
Enterprise
Enterprise
Explanation
Enterprise
b. Adding a new function
Just add a new function like the following example. Here we will add
a new function call block_product() and then call it in our
overridden function .
Enterprise
Steps
Enterprise
2. Extending a component
Extending a component is usually done when it is necessary to
make a new component based of an already existing component.
This way any new functions or modifications done to this
component will not affect the original parent component.
Explanation
Enterprise
Here in this case , extending is used to make new popups based
on the AbstractAwaitablePopup parent component .
In the following example i am trying to make a custom error popup
which has title “Error Custom” as default instead of “Error” and
which also plays a bell sound instead of the usual error sound .
Enterprise
Explanation
Enterprise
Now let’s call this custom error popup in our overridden function .
Enterprise
Enterprise
Conclusion
Enterprise
Hence these are the differences between patching and extending
components in Odoo 17 .
For More Info.
Check our company website for related blogs
and Odoo book.
Check our YouTube channel for
functional and technical videos in Odoo.
Enterprise
www.cybrosys.com

Differences between Patching and Extending components in Odoo 17

  • 1.
    Differences between Patchingand Extending components in Odoo 17 Enterprise
  • 2.
    Introduction Enterprise OWL, odoo’s frontendframework is a robust and extensive tool used by odoo developers for making frontend modification/customization. Here we are going to see the purpose and difference between patching and extending a component .
  • 3.
    Steps Enterprise 1. Patching Patching ismainly used to override or add functions to a component . a. Override existing function i. To override existing function just call the function, call the super method and then add in the required code
  • 4.
    Example Enterprise Let us seean example. I am going to modify the Pos item list so that a dialog box saying input block appears whenever we try to add a product and hence will prevent users from adding in the product .
  • 5.
  • 6.
  • 7.
    Explanation Enterprise b. Adding anew function Just add a new function like the following example. Here we will add a new function call block_product() and then call it in our overridden function .
  • 8.
  • 9.
    Steps Enterprise 2. Extending acomponent Extending a component is usually done when it is necessary to make a new component based of an already existing component. This way any new functions or modifications done to this component will not affect the original parent component.
  • 10.
    Explanation Enterprise Here in thiscase , extending is used to make new popups based on the AbstractAwaitablePopup parent component . In the following example i am trying to make a custom error popup which has title “Error Custom” as default instead of “Error” and which also plays a bell sound instead of the usual error sound .
  • 11.
  • 12.
    Explanation Enterprise Now let’s callthis custom error popup in our overridden function .
  • 13.
  • 14.
  • 15.
    Conclusion Enterprise Hence these arethe differences between patching and extending components in Odoo 17 .
  • 16.
    For More Info. Checkour company website for related blogs and Odoo book. Check our YouTube channel for functional and technical videos in Odoo. Enterprise www.cybrosys.com