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

Hello everybody, I‌ am trying to load a js file in odoo16 according to the odoo16 document but I can't and it doesn't load my js file despite that it doesn't give any error, I wondered if there is anyone to help me to load a js file in odoo

and I would be appreciated to contact me by email and fix this problem via google meet or anything that you think is true.


mohsen.1398.pg@gmail.com


__manifest__.py

# -*- coding: utf-8 -*-

{

​"name": "Test Module",

​'version': '1.0',

​'category': 'Theme',

​"depends": ['base','website','website_sale_wishlist' ],

​'assets': {

​'web.assets_frontend': [

​'TestModule/static/src/js/content/testfile.js'

​ ],

​ },

​'installable': True,

​'auto_install': True,

}


My Js FIle


odoo.define('TestModule.testfile', function (require) {

​'use strict';

​var publicWidget = require('web.public.widget');

​publicWidget.registry.testWebsite = publicWidget.Widget.extend(

​{

​selector:'.o_wsale_products_main_row',

​init() {

​console.log('=============');

​},

​ })

});


these codes are for /shop page on the website, when you browes the /shop page in browser it will load it

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

Thanks, Niyas Raphy
I have shared my code, and I don't think this code be unlike the document of odoo16

Câu trả lời hay nhất

your js file is already loading to check it put "console.log" below "use strict" then check it again.

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

Hi mohsen

Your JS file has already been loaded and registered in Odoo. You can navigate to the shop page and check the browser's console log to confirm that your JS file is being called on the '\shop' page.

Hope this will help you.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 7 23
2500
3
thg 8 25
2321
1
thg 5 25
2545
1
thg 4 25
3515
1
thg 4 25
4344