<?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
- Boekhouding
- Voorraad
- PoS
- Project
- MRP
Deze vraag is gerapporteerd
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"
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!
Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!
Aanmelden