<?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:
- सीआरएम
- e-Commerce
- लेखांकन
- इन्वेंटरी
- PoS
- Project
- MRP
This question has been flagged
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"
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up