odoo 10如何创建片段Javascript选项 [英] odoo 10 how to create Snippets Javascript option

查看:67
本文介绍了odoo 10如何创建片段Javascript选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试根据 https://www.odoo.com/documentation/10.0/howtos/themes.html#create-snippets

我创建了代码片段并添加了js选项,即示例中的代码

I created the snippets and add the js option, the code from the example

(function() {
    'use strict';
    var website = odoo.website;
    website.odoo_website = {};

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

由于未定义odoo.website而失败,请参见

fails since odoo.website is not defined see

请帮助

推荐答案

这是/theme_tst/static/src/js/tutorial_editor.js的正确代码

here is the correct code for /theme_tst/static/src/js/tutorial_editor.js

odoo.define('snippet_testimonial_options', function(require) {

    'use strict';

    var options = require('web_editor.snippets.options');

    options.registry.snippet_testimonial_options = options.Class.extend({

        on_focus: function() {

            alert("On focus!")

        },

    });

});

这篇关于odoo 10如何创建片段Javascript选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆