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

Hello Odoo Community,

I am facing issues importing JavaScript files between two custom modules in Odoo. Despite proper configuration, including correctly setting up asset bundles and dependencies, the imports are not functioning as expected.

Details of the Setup

Odoo Version: [Specify your Odoo version, e.g., 14, 15]

  • Exporting Module (export_from_module):
    • JavaScript File Path: /export_from_module/static/src/js/test_console_log.js
    • Content of the JavaScript File:
      /** @odoo-module **/
      export const greeting = "Hello from export_from_module!";
      
    • Asset Bundle Declaration in __manifest__.py:
      'assets': {
          'web.assets_backend': [
              'export_from_module/static/src/js/test_console_log.js',
          ],
      },
      
  • Importing Module (import_to_module):
    • Dependencies Listed in __manifest__.py: Includes export_from_module to ensure loading order.
    • JavaScript File (importing.js) Trying to Import test_console_log.js:
      /** @odoo-module **/
      import { greeting } from '/export_from_module/static/src/js/test_console_log';
      console.log("Imported greeting:", greeting);
      
    • Asset Bundle Declaration in __manifest__.py:
      'assets': {
          'web.assets_backend': [
              'import_to_module/static/src/js/importing.js',
          ],
      },
      

Steps Already Taken

  1. Verified Module Paths and Names: Ensured that the paths in the import statements were correct and matched the directory structure.
  2. Asset Declarations: Double-check that JavaScript files are correctly declared in their respective module’s asset bundle for backend assets.
  3. Dependency Management: Confirmed correct module dependency declarations.
  4. Browser Cache and Server Restart: Cleared cache and restarted the server to avoid any caching issues.
  5. Debug Mode: Enabled asset to debug mode (?debug=assets) to trace how individual files are loaded.

Issues Encountered

Despite these steps, I encounter errors related to unmet dependencies and missing modules, as indicated by the Odoo asset management system:

  • Error Messages:
    • "The following modules are needed by other modules but have not been defined; they may not be present in the correct asset bundle..."
    • "The following modules could not be loaded because they have unmet dependencies..."


الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
مارس 22
6146
2
يوليو 17
4106
1
مايو 25
7691
1
نوفمبر 21
2981
1
ديسمبر 15
7542