Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
6979 Lượt xem

I've followed what the docs and various tutorials say about creating custom JS modules.

I created this file 

console.log("I'm here!!");
openerp.mymodule = function(instance){
    console.log("loading my module...");
};

and placed it in the static/src/js folder of the module. I added this path to the "js" key of the manifest file.

When I open the browser console and load the page, "I'm here" does get printed, but "loading my module..." never does. What am I missing?
 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

It depends. If you are using JS on v7 or V8.

In v7 you can add it to __openerp__.py.

In v8 you have to add it to views

Anyways, I think that you made it work. So the main reason must be:

you module name is not named 'mymodule'

in order to make it work please set that openerp.module_name

Ảnh đại diện
Huỷ bỏ
Tác giả

Duh! That was it. Thank you very much,

Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 8 22
9676
1
thg 3 22
6308
2
thg 6 18
8901
0
thg 3 15
3541
0
thg 7 25
257