Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
4 ตอบกลับ
6391 มุมมอง

I am trying to complete the Odoo 9 theme tutorial located here https://www.odoo.com/documentation/9.0/howtos/themes.html

I having a problem with the "javascript options" section, specifically using the code provided I get the exception "Uncaught ReferenceError: openerp is not defined".

I have tried to read around the problem, but cannot find anybody with the same issue. I have however read in other documentation that the "openerp" global variable has been removed. If this is the case what is best practice for achieving the intent of the tutorial in this section?

I have also had problems with other parts of the tutorial which I have been able to solve through other resources.

อวตาร
ละทิ้ง

Maybe use odoo global variable ?

ผู้เขียน

I have tried this already, the "odoo" variable has no "Website" property, and nothing that is clear, as far as I can see, that replaces it.

คำตอบที่ดีที่สุด

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!")

                                    },

                        });

});

อวตาร
ละทิ้ง

one month later..., same response that below..
Without uses of code tag... :/

คำตอบที่ดีที่สุด

Hello, 

Sorry the doc for v9 theme seems to be not already updated.


Find below an example:

odoo.define('foo.bar', function (require) {
'use strict';
var website = require('website.website');
var options = require('web_editor.snippets.options');
options.registry.bar = s_options.Class.extend({
start: function () {
var self = this;
this.$content = this.$target.find('.lorem');
},
});
});


In any case,s you can easily find many example in addons website (website/static/src/js/) and others modules (website_*)

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
3
พ.ย. 16
4440
1
ม.ค. 21
5252
2
ม.ค. 17
4340
1
ม.ค. 16
6389
1
ธ.ค. 24
5539