Odoo widget js code works for version 8, but not for version 9?

Why the code below does not work for odoo 9, but it works for odoo 8 ...

openerp.petstore = function(instance, local) { instance.web.form.widgets = instance.web.form.widgets.extend( { 'test' : 'instance.web.form.message', }); instance.web.form.message = instance.web.form.FieldChar.extend( { template: 'test', start: function() { alert('working'); } }); } 
+6
source share
2 answers

You tried:

 openerp.oepetstore = function(instance, local) { local.test = instance.Widget.extend({ start: function() { alert('working'); }, }); instance.web.client_actions.add( 'petstore.test', 'instance.oepetstore.test'); } 

Make sure you check the correct version of the documentation , as the web client has gone through some important changes.

0
source

Hello Mr. Mani

Try this code below.

 openerp.oepetstore = function(instance, local) { # _t and _lt is use for convert text to python and java script. var _t = instance.web._t, _lt = instance.web._lt; var QWeb = instance.web.qweb; local.HomePage = instance.Widget.extend({ start: function() { alert("Hello Mani..."); console.log("Hello Mani.."); }, }); instance.web.client_actions.add( 'petstore.homepage', 'instance.oepetstore.HomePage'); } 

More info for odoo 9 js reads this below the best website,
1. https://www.odoo.com/documentation/9.0/howtos/web.htm
2. http://javascript.qahowto.com/Odoo-9-How-to-override-form-widgets-javascript-openerp-qweb-odoo-9-2100c58

Hope my answer will be helpful. If any request so comment, please.

0
source

Source: https://habr.com/ru/post/1015511/


All Articles