Skip to Content
Menu
This question has been flagged
1 Reply
3407 Views

So we have written an odoo15 module in the legacy javascript format , but now are going to upgrade the code into the odoo16 version.

To be exact, we have used extended the DatePicker field and it works completely fine in v15. 
However, the new v16 uses owl framework and the code is written in a completely different way, but there  I can find ' /legacy' folder still on the odoo16 module, but when the code javascript does not work in v16. 

Is there any way I can use the legacy version of the code in odoo16 as well?

......................................................................................................................................


......................................................................................................................................

Also , in 15 we used to use .extend method in order to add some feature to a js model, its counterpart in odoo is to use prototyping patch method? 

Avatar
Discard
Best Answer

Hi,

Odoo regularly deprecates code in new versions, which means certain functions or modules might no longer exist or have changed significantly. The underlying architecture of Odoo might have changed, making the older code incompatible with the newer version. Newer versions of Odoo may introduce changes to the database schema, which can affect the compatibility of older code. Update the legacy code to the new version of Odoo by making necessary changes, removing deprecated functions, and updating module structures. If there are substantial changes between versions, you may use migration tools or scripts to help automate some of the code adaptation. Using legacy code might not be the most optimal approach in the long run.

The extend method is used to create a new class that inherits from an existing class and adds or overrides its methods. It allows you to extend the functionality of an existing class without modifying the original class directly. Patching is a way to modify the behavior of an existing method without overriding it completely. In OWL, patching can be achieved using the "patch" method provided by the framework.
That means patching is not used as the counterpart to extend; both are used in different scenarios. You can refer to the blogs

https://www.cybrosys.com/blog/super-override-existing-functions-using-owl
https://www.cybrosys.com/blog/how-to-patch-existing-owl-component-in-odoo-16

Hope it helps

Avatar
Discard
Author

Looks like i need to patch the original DatePicker in order to get what I want here.
I need to change the behaviour of the default datepicker that odoo has , I need to load two calendars here , one is the odoo datepicker and another is the custom nepali datepicker.
https://www.odoo.com/id_ID/forum/help-1/odoo16-owl-adding-a-custom-datepicker-alongside-the-original-datepicker-230437

id appreciate if you looked through this post as well, as it contains more details on what i intend to do

Related Posts Replies Views Activity
0
Jan 25
901
0
Sep 23
2843
1
May 23
2169
3
Oct 23
5078
3
Jun 23
4874