<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<template id="assets_backend_inherit" inherit_id="web.assets_backend" name="Custom Backend Assets">
<xpath expr="." position="inside">
<link rel="stylesheet" type="text/css" href="custom_theme/static/src/css/theme.css"/>
</xpath>
</template>
</odoo>
this is my header.xml file
'name': 'Custom Theme Background',
'description': 'Custom website theme',
'category': 'Theme',
'sequence': 10,
'version': '16.0.1',
'depends': ['base_setup', 'base', 'web', 'web_enterprise'],
'data': [
'views/header.xml',
# 'views/footer.xml',
],
'assets': {
'web.assets_backend': [
'/custom_theme/static/src/css/theme.css',
],
},
'installable': True,
'application': False,
'license': 'LGPL-3',
}
help me with this
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
In Odoo 16, the assets management system has changed. The old web.assets_backend no longer exists. Instead, Odoo 16 uses:
- web._assets_backend → For the Community edition
- web._assets_enterprise → For the Enterprise edition
So, if we try to inherit web.assets_backend, Odoo will throw an error because it does not exist.
Solution:
✅ 1. Update the header.xml file
Modify the inherit_id in your XML file:
xml
CopyEdit
<?xml version="1.0" encoding="UTF-8"?> <odoo> <template id="assets_backend_inherit" inherit_id="web._assets_backend" name="Custom Backend Assets"> <xpath expr="." position="inside"> <link rel="stylesheet" type="text/css" href="/custom_theme/static/src/css/theme.css"/> </xpath> </template> </odoo>
If you are using Odoo Enterprise, replace web._assets_backend with web._assets_enterprise.
✅ 2. Correctly Define Assets in __manifest__.py
In Odoo 16, assets are defined inside the assets dictionary. Update your __manifest__.py:
python
CopyEdit
'assets': { 'web._assets_backend': [ '/custom_theme/static/src/css/theme.css', ], },
Again, for Enterprise Edition, use web._assets_enterprise.
Restart odoo
Hi Ahamed,
It seems that you are trying to append the stylesheet.
Do you mind to try the steps below? I took reference from "crm" module.
- Remove the xml, don't append through template inheritance.
- Inside the manifest.py, remove the slash(/) before "custom_theme"
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký