Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
157 Tampilan

Hello, I have an issue with odoo 18. i created a custom module meant for snippets and wondering why my js files not showing up and the dynamic snippet is not being loaded up. It was working at first but on trying again on different database, it is not working . What could be the issue. Thanks in advance.




//manifest file

 {

    "name": "my Ecommerce Snippets",

    "version": "1.0",

    "category": "Theme/Website",  # Changed from 'Themes/Website'

    "summary": "Custom e-commerce theme with snippets",

    "license": "LGPL-3",

    "author": "eli",

    "maintainer": "eli Techno Solutions",

    "website": "",

    "images": [

        "static/description/icon.png",  # Optional: for app store banner/screenshots

    ],

    "depends": ["website", "website_sale"],  # Added theme_default

    "data": [

        "views/snippets/static_template.xml",

        "views/snippets/new_arrivals_initializer.xml",

        "views/snippets/medicine_categories_initializer.xml",

        "views/snippets/campaigns_carousel_initializer.xml",

        "views/snippets/trusted_brands_initializer.xml",

        "views/snippets/snippets.xml",

    ],

    "assets": {

        "web.assets_frontend": [

            "/my_ecommerce_website/static/src/js/new_arrivals_snippet.js",

            "/my_ecommerce_website/static/src/js/medicine_categories_snippet.js",

            "/my_ecommerce_website/static/src/xml/new_arrivals_snippet_templates.xml",

            "/my_ecommerce_website/static/src/xml/medicine_categories_snippet_templates.xml",

        ],

    },

    "installable": True,

    "auto_install": False,

    "application": False,

}


Avatar
Buang
Jawaban Terbai

Hi,


You’re facing an issue in Odoo 18 where your custom snippet module’s JavaScript files aren’t loading, causing dynamic snippets to stop working. This often happens due to how Odoo handles asset caching and file paths in the frontend. One common cause is incorrect asset paths in the manifest — the paths must exactly match the actual module folder name and directory structure. Caching is another frequent issue; Odoo may reuse old assets from a previous database, so updating the module with -u or clearing cached assets in Developer Mode can fix it.


It’s also important to ensure your snippet templates and assets are properly registered. Each snippet XML file should be correctly wrapped within <odoo><template>...</template></odoo>, and your manifest should list assets under web.assets_frontend with correct paths. If snippets still don’t appear, verify that your frontend templates include the t-call-assets directive so Odoo knows to load your JS files. Additionally, rebuilding assets using --dev=assets and checking for JavaScript errors in the browser console can help identify what’s missing.


Finally, confirm that the module name in your manifest matches the folder name, since any mismatch prevents Odoo from finding the files. After correcting paths, clearing caches, and rebuilding assets, your dynamic snippets should start loading again.



Hope it helps

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
1
Mar 23
2813
1
Agu 21
4636
1
Mar 17
3244
0
Feb 25
859
0
Sep 24
1262