تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
1093 أدوات العرض

Hello,

I am encountering an issue in Odoo 18 while working with JavaScript files for a website theme. Specifically, the plugins are throwing errors such as 'x' is not defined and similar issues.

Although jQuery (version 3.6.3) is included in the web module/package and is loaded by default in the web.assets_frontend bundle, the errors persist even when using plugins compatible with this version of jQuery.

NOTE : To clarify, I am using the plugins exactly as provided by the CDN, without any modifications to their code.

Here are the approaches I have tried in the web.assets_frontend bundle within the __manifest__.py file:

  1. Attempted to load the assets without explicitly including jQuery, as the required plugins are already compatible with version 3.6.3.
  2. Used a direct CDN link for jQuery.
  3. Provided a local path to jQuery in the asset declaration.


My primary goal is to implement animated snippets on the website. However, despite trying the above approaches, I have been unable to resolve the issue.

I would greatly appreciate any insights or solutions to overcome this challenge.

الصورة الرمزية
إهمال
أفضل إجابة

Hello Mohammed Salman Uddin,


I hope you are doing well.


To resolve the issue, I recommend the following approach:

- Import loadJS from Odoo's core assets in the JavaScript file where you wish to implement the feature:

import { loadJS } from "@web/core/assets";

- Then, use loadJS(url) to load the JavaScript file from the URL:

loadJS(url);


- This method helps avoid any potential jQuery issues and prevents script conflicts.

- It ensures a smooth and efficient loading process for external JavaScript files in Odoo.

- Make sure to check the compatibility of the external JavaScript with your Odoo version.


I Hope this information proves helpful to you.


Thanks & Regards,

Email:   odoo@aktivsoftware.com

Skype: kalpeshmaheshwari

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
نوفمبر 24
1336
5
أغسطس 25
9766
2
يوليو 25
934
4
يونيو 25
1050
1
يونيو 25
1349