コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
82 ビュー

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,

}


アバター
破棄
最善の回答

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

アバター
破棄
関連投稿 返信 ビュー 活動
1
3月 23
2797
1
8月 21
4631
1
3月 17
3239
0
2月 25
815
0
9月 24
1255