2017-08-14 41 views
0

我经历的odoo 10主题教程以下网站 https://www.odoo.com/documentation/10.0/howtos/themes.html#javascript-optionsodoo_website变量odoo 10没有定义,而在自定义添加JavaScript片段

我确实做到了这本教程说什么,但也我在下面得到错误代码:

(function() { 
    'use strict'; 

    var website = odoo.website; 
    website.odoo_website = {};// odoo_website veriable is undefined; 

website.snippet.options.snippet_testimonial_options = website.snippet.option.extend({ 
    on_focus: function() { 
     alert("On focus!"); 
    } 
}) 
})(); 

这里是控制台的屏幕截图: error screen shot odoo 10 odoo_website

回答

0

尝试

(function() { 
    'use strict'; 
    var website = openerp.website; 
    website.openerp_website = {}; 
})(); 
+2

对代码的小解释会不会更好? –