SlideShare a Scribd company logo
4
Most read
5
Most read
6
Most read
How to create a theme
module in Odoo 17
Enterprise
Introduction
Enterprise
For Odoo website, there will be a theme set by default. In Odoo 17, this will
be done by odoo automatically once we install the ‘website’ module from
the Apps list and just clicking on the ‘Activate’ button.
Enterprise
Then click on the theme we need. This will lead us to the Editor view of the
website, where many snippets, styles, other themes and customization can
be chosen.
Enterprise
Odoo allows the developers to create their own new modules to apply
as a theme for the server. Let’s check how it is done in Odoo 17.
Let’s create a very simple module with essential view’s xml files and
static folder with css/ scss directory. Here, we’ve made a new module
named theme_custom.
Enterprise
For a Theme module, the manifest file can be like
{
'name': 'Custom Theme for Odoo',
'version': '17.0.1.0.0',
'category': 'Theme/sub_category',
'summary': 'customized for the web pages',
'description': 'This is a simple theme module which adds color changes and '
'styles for the web pages',
'installable': True,
'license': 'LGPL-3',
'application': True,
'sequence': 1,
'depends': ['website'],
'data': [
'views/theme_views.xml'
],
'assets': {
'web.assets_frontend': [
'/theme_custom/static/src/scss/style.scss'
],
},
}
Enterprise
Creating the Web page
For a web page to get created in the Odoo website, we have to define the xml files
inside the view directory. Inside that, first we have to give the code for creating a
menu in the web page. This is done by creating a record for website.menu model as
<record id="menu_home" model="website.menu">
<field name="name">Test</field>
<field name="url">/test</field>
<field name="page_id" ref="theme_custom.test_page"/>
<field name="parent_id" ref="website.main_menu"/>
<field name="sequence" type="int">10</field>
</record>
● name is the name of the website menu
● url specifies the URL of the webpage being created
● page_id refers to the xml id of the page which is to be loaded on the menu click
● parent_id website.main_menu must be kept to be shown under the main menu list
● sequence specifies the order of the menu
Enterprise
In the same file itself, we can add the code for creating the web page as
<record id="test_page" model="website.page">
<field name="name">Test page</field>
<field name="website_published">True</field>
<field name="url">/test</field>
<field name="type">qweb</field>
<field name="key">theme_custom.theme_views</field>
<field name="arch" type="xml">
<t t-name="theme_custom.test_page_template">
<t t-call="website.layout">
<div id="wrap">
<div class="container oe_structure">
<h1 class="test-heading"> TestPage </h1>
<ul class="test">
<li>Feature 1</li><li>Feature 2</li><li>Feature 3</li>
</ul>
</div>
</div>
</t></t>
</field>
</record>
Enterprise
After upgrading the module and refreshing the webpage, we can see
the new menu and page as
Enterprise
Now, to show that the theme is working, the styling of the test page is
incorporated using CSS or SCSS files. Add this inside static/scss directory as
.test-heading {
color: black;
}
.test {
background: bisque;
border-radius: 8px;
padding: 0.8em;
margin: 2em 0 3em;
li {
display: block;
position: relative;
padding: 2em;
color: #FFF;
text-align: center;
margin-bottom: 1em;
background-color: cadetblue;
font-size: 1.0em;
}
}
Enterprise
In this scss code, it just adds the black color for the tags with class ‘test-
heading’. For the contents with class ‘test’, some extra style details are
given. In the earlier xml file for the web page content, we have already
added the content with these classes. But, there we saw no change
affected. This is because, here Odoo 17 is running with the default
theme added during the website module installation.
To change the newly added theme, we have to switch to the custom
theme we added through code. For that, first make the website to Edit
mode by clicking on the marked ‘Edit’ button on top.
Enterprise
Now, we can see the snippets and customization panel there on right side. Select
the third page ‘THEME’, and under the ‘Website’ tag, click on ‘Switch Theme’ button.
Enterprise
A confirmation bow will come then. Click on ‘OK’ and after that, we can see our
custom theme will be visible there to select. Hover the mouse on it to see the
button ‘Use this Theme’. Click on it
Enterprise
Then, do nothing because we have to wait for some seconds for the theme to get
set by Odoo. By the time, the screen will be as
Enterprise
Now, we can see that the content of our webpage under the new ‘Test’ menu will be
added with the CSS styles as
Enterprise
Adding snippets to theme module
In Odoo, snippets are reusable pieces of content that can be easily inserted
into web pages through the website builder. They are used to streamline the
process of creating and editing web pages by providing pre-designed
content blocks such as headers, footers, text blocks, image galleries, forms,
and more.
To create a simple snippet for our module, let’s add the xml code for the
snippet template in the views/test_page.xml file.
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<template id="test_snippet" name="Test Snippet">
<section class="container oe_structure">
<h1 class="test-heading">Test Snippet</h1>
<ul class="test">
<li>Snippet Feature 1</li>
<li>Snippet Feature 2</li>
<li>Snippet Feature 3</li>
</ul>
</section>
</template>
</odoo>
Enterprise
Add the created snippet to the building blocks with xml code and save it in
the views/snippets/test_snippet.xml file.
<template id="test_snippet_register" inherit_id="website.snippets"
name="Test Snippet Register">
<xpath expr="//div[@id='snippet_structure']/div[hasclass('o_panel_body')]"
position="inside">
<t t-snippet="theme_custom.test_snippet"
t-thumbnail="/theme_custom/static/src/img/test_thumbnail.png"/>
</xpath>
</templates>
Enterprise
After upgrading the module, go to website and take the editor’s mode. Then, we
can see the Test snippet under the Structure section
Enterprise
We can just drag and drop to any page where we need as we do with the default
snippets in Odoo 17 website. Here, the snippet is dropped twice in our Test page
Enterprise
After completing these steps, your custom theme should be active
on your Odoo 17 website. We can further customize the theme by
adding more CSS, JavaScript, and adjusting the templates as needed.
This kind of custom themes creation allows the developers to get the
opportunity to tailor the website's appearance to specific
requirements. By following the outlined steps, users can install,
apply, and customize themes seamlessly within the Odoo
framework. The process involves organizing files, defining page
layouts, styling with CSS or SCSS, and incorporating custom snippets
for enhanced website functionality.
For More Info.
Check our company website for related blogs
and Odoo book.
Check our YouTube channel for
functional and technical videos in Odoo.
Enterprise
www.cybrosys.com

More Related Content

PPTX
URLs and Routing in the Odoo 17 Website App
PDF
Build and deploy Python Django project
PPTX
URLS and routing in odoo 18 - Odoo Slides
PPTX
How to Create a Custom Web Form View in Odoo 17
PPT
DJango
PPTX
How To Extend Odoo Form View using js_class_
PPTX
How to add menu in Odoo 17 Website - Odoo 17 Slides
PPT
Joomla Beginner Template Presentation
URLs and Routing in the Odoo 17 Website App
Build and deploy Python Django project
URLS and routing in odoo 18 - Odoo Slides
How to Create a Custom Web Form View in Odoo 17
DJango
How To Extend Odoo Form View using js_class_
How to add menu in Odoo 17 Website - Odoo 17 Slides
Joomla Beginner Template Presentation

Similar to How to Create a Theme Module in Odoo 17 - Odoo 17 Slides (20)

PDF
Django tutorial
PPTX
How to Create a Dynamic Snippet in Odoo 17
DOCX
Creating a basic joomla
PPTX
crtical points for customizing Joomla templates
PDF
Designing for magento
DOCX
Adding a view
PDF
OpenCms Days 2013 - How to update smoothly to OpenCms 9ms 9
PPTX
How to perform product search based on a custom field from the PoS screen of ...
PPTX
mean stack
PDF
Odoo - Create themes for website
DOCX
Master page
PDF
06 laboratory exercise 1
PDF
Introduction to Django
PPTX
Odoo 15 Composition of Module
PPT
STSADM Automating SharePoint Administration - Tech Ed South East Asia 2008 wi...
PPTX
How to Add a Custom Button in Pos Odoo 17
PPTX
Customization of Odoo 17 Periodic Digest parameters from backend
PPT
Mageguru - magento custom module development
PPTX
Learn html and css from scratch
PDF
SharePoint Re-branding The VisualStudio Way Part One SandBox Solution
Django tutorial
How to Create a Dynamic Snippet in Odoo 17
Creating a basic joomla
crtical points for customizing Joomla templates
Designing for magento
Adding a view
OpenCms Days 2013 - How to update smoothly to OpenCms 9ms 9
How to perform product search based on a custom field from the PoS screen of ...
mean stack
Odoo - Create themes for website
Master page
06 laboratory exercise 1
Introduction to Django
Odoo 15 Composition of Module
STSADM Automating SharePoint Administration - Tech Ed South East Asia 2008 wi...
How to Add a Custom Button in Pos Odoo 17
Customization of Odoo 17 Periodic Digest parameters from backend
Mageguru - magento custom module development
Learn html and css from scratch
SharePoint Re-branding The VisualStudio Way Part One SandBox Solution
Ad

More from Celine George (20)

PPTX
How to Implement OWL Notification Service in Odoo 18
PPTX
Tracking Profit Margins in Sales Orders with Odoo 18
PPTX
How to Configure Outgoing Shipment in 3 Steps Using Odoo 18
PPTX
How to Configure Outgoing Shipment in 1 Step Using Odoo 18.pptx
PPTX
How to Configure Outgoing Shipment in 2 Steps Using Odoo 18
PPTX
How to Add New Applicants in Odoo 18 Recruitment
PPTX
How to Analyze the Recruitment Process in Odoo 18 Recruitment
PPTX
How to Manage Referral Reporting in Odoo 18 Referrals
PPTX
How to Set, Track, & Review Employee Goals in Odoo 18 Appraisals
PPTX
Revamp in MTO Odoo 18 Inventory - Odoo Slides
PPTX
How to Manage Starshipit in Odoo 18 - Odoo Slides
PPTX
How to Manage Bill Control Policy in Odoo 18
PPTX
How to Manage Loyalty Points in Odoo 18 Sales
PPTX
Odoo 18 Sales_ Managing Quotation Validity
PPTX
How to Manage Global Discount in Odoo 18 POS
PPTX
How to Manage Leads in Odoo 18 CRM - Odoo Slides
PPTX
Tips Management in Odoo 18 POS - Odoo Slides
PPTX
How to Close Subscription in Odoo 18 - Odoo Slides
PPTX
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
PPTX
How to Track Skills & Contracts Using Odoo 18 Employee
How to Implement OWL Notification Service in Odoo 18
Tracking Profit Margins in Sales Orders with Odoo 18
How to Configure Outgoing Shipment in 3 Steps Using Odoo 18
How to Configure Outgoing Shipment in 1 Step Using Odoo 18.pptx
How to Configure Outgoing Shipment in 2 Steps Using Odoo 18
How to Add New Applicants in Odoo 18 Recruitment
How to Analyze the Recruitment Process in Odoo 18 Recruitment
How to Manage Referral Reporting in Odoo 18 Referrals
How to Set, Track, & Review Employee Goals in Odoo 18 Appraisals
Revamp in MTO Odoo 18 Inventory - Odoo Slides
How to Manage Starshipit in Odoo 18 - Odoo Slides
How to Manage Bill Control Policy in Odoo 18
How to Manage Loyalty Points in Odoo 18 Sales
Odoo 18 Sales_ Managing Quotation Validity
How to Manage Global Discount in Odoo 18 POS
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Tips Management in Odoo 18 POS - Odoo Slides
How to Close Subscription in Odoo 18 - Odoo Slides
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
How to Track Skills & Contracts Using Odoo 18 Employee
Ad

Recently uploaded (20)

PDF
Sports Quiz easy sports quiz sports quiz
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
Lesson notes of climatology university.
PDF
RMMM.pdf make it easy to upload and study
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Basic Mud Logging Guide for educational purpose
PDF
Pre independence Education in Inndia.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Insiders guide to clinical Medicine.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
PPH.pptx obstetrics and gynecology in nursing
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
Cell Structure & Organelles in detailed.
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Sports Quiz easy sports quiz sports quiz
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Lesson notes of climatology university.
RMMM.pdf make it easy to upload and study
Final Presentation General Medicine 03-08-2024.pptx
Supply Chain Operations Speaking Notes -ICLT Program
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Basic Mud Logging Guide for educational purpose
Pre independence Education in Inndia.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
Module 4: Burden of Disease Tutorial Slides S2 2025
Insiders guide to clinical Medicine.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
Renaissance Architecture: A Journey from Faith to Humanism
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Microbial disease of the cardiovascular and lymphatic systems
PPH.pptx obstetrics and gynecology in nursing
GDM (1) (1).pptx small presentation for students
Cell Structure & Organelles in detailed.
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf

How to Create a Theme Module in Odoo 17 - Odoo 17 Slides

  • 1. How to create a theme module in Odoo 17 Enterprise
  • 2. Introduction Enterprise For Odoo website, there will be a theme set by default. In Odoo 17, this will be done by odoo automatically once we install the ‘website’ module from the Apps list and just clicking on the ‘Activate’ button.
  • 3. Enterprise Then click on the theme we need. This will lead us to the Editor view of the website, where many snippets, styles, other themes and customization can be chosen.
  • 4. Enterprise Odoo allows the developers to create their own new modules to apply as a theme for the server. Let’s check how it is done in Odoo 17. Let’s create a very simple module with essential view’s xml files and static folder with css/ scss directory. Here, we’ve made a new module named theme_custom.
  • 5. Enterprise For a Theme module, the manifest file can be like { 'name': 'Custom Theme for Odoo', 'version': '17.0.1.0.0', 'category': 'Theme/sub_category', 'summary': 'customized for the web pages', 'description': 'This is a simple theme module which adds color changes and ' 'styles for the web pages', 'installable': True, 'license': 'LGPL-3', 'application': True, 'sequence': 1, 'depends': ['website'], 'data': [ 'views/theme_views.xml' ], 'assets': { 'web.assets_frontend': [ '/theme_custom/static/src/scss/style.scss' ], }, }
  • 6. Enterprise Creating the Web page For a web page to get created in the Odoo website, we have to define the xml files inside the view directory. Inside that, first we have to give the code for creating a menu in the web page. This is done by creating a record for website.menu model as <record id="menu_home" model="website.menu"> <field name="name">Test</field> <field name="url">/test</field> <field name="page_id" ref="theme_custom.test_page"/> <field name="parent_id" ref="website.main_menu"/> <field name="sequence" type="int">10</field> </record> ● name is the name of the website menu ● url specifies the URL of the webpage being created ● page_id refers to the xml id of the page which is to be loaded on the menu click ● parent_id website.main_menu must be kept to be shown under the main menu list ● sequence specifies the order of the menu
  • 7. Enterprise In the same file itself, we can add the code for creating the web page as <record id="test_page" model="website.page"> <field name="name">Test page</field> <field name="website_published">True</field> <field name="url">/test</field> <field name="type">qweb</field> <field name="key">theme_custom.theme_views</field> <field name="arch" type="xml"> <t t-name="theme_custom.test_page_template"> <t t-call="website.layout"> <div id="wrap"> <div class="container oe_structure"> <h1 class="test-heading"> TestPage </h1> <ul class="test"> <li>Feature 1</li><li>Feature 2</li><li>Feature 3</li> </ul> </div> </div> </t></t> </field> </record>
  • 8. Enterprise After upgrading the module and refreshing the webpage, we can see the new menu and page as
  • 9. Enterprise Now, to show that the theme is working, the styling of the test page is incorporated using CSS or SCSS files. Add this inside static/scss directory as .test-heading { color: black; } .test { background: bisque; border-radius: 8px; padding: 0.8em; margin: 2em 0 3em; li { display: block; position: relative; padding: 2em; color: #FFF; text-align: center; margin-bottom: 1em; background-color: cadetblue; font-size: 1.0em; } }
  • 10. Enterprise In this scss code, it just adds the black color for the tags with class ‘test- heading’. For the contents with class ‘test’, some extra style details are given. In the earlier xml file for the web page content, we have already added the content with these classes. But, there we saw no change affected. This is because, here Odoo 17 is running with the default theme added during the website module installation. To change the newly added theme, we have to switch to the custom theme we added through code. For that, first make the website to Edit mode by clicking on the marked ‘Edit’ button on top.
  • 11. Enterprise Now, we can see the snippets and customization panel there on right side. Select the third page ‘THEME’, and under the ‘Website’ tag, click on ‘Switch Theme’ button.
  • 12. Enterprise A confirmation bow will come then. Click on ‘OK’ and after that, we can see our custom theme will be visible there to select. Hover the mouse on it to see the button ‘Use this Theme’. Click on it
  • 13. Enterprise Then, do nothing because we have to wait for some seconds for the theme to get set by Odoo. By the time, the screen will be as
  • 14. Enterprise Now, we can see that the content of our webpage under the new ‘Test’ menu will be added with the CSS styles as
  • 15. Enterprise Adding snippets to theme module In Odoo, snippets are reusable pieces of content that can be easily inserted into web pages through the website builder. They are used to streamline the process of creating and editing web pages by providing pre-designed content blocks such as headers, footers, text blocks, image galleries, forms, and more. To create a simple snippet for our module, let’s add the xml code for the snippet template in the views/test_page.xml file. <?xml version="1.0" encoding="UTF-8" ?> <odoo> <template id="test_snippet" name="Test Snippet"> <section class="container oe_structure"> <h1 class="test-heading">Test Snippet</h1> <ul class="test"> <li>Snippet Feature 1</li> <li>Snippet Feature 2</li> <li>Snippet Feature 3</li> </ul> </section> </template> </odoo>
  • 16. Enterprise Add the created snippet to the building blocks with xml code and save it in the views/snippets/test_snippet.xml file. <template id="test_snippet_register" inherit_id="website.snippets" name="Test Snippet Register"> <xpath expr="//div[@id='snippet_structure']/div[hasclass('o_panel_body')]" position="inside"> <t t-snippet="theme_custom.test_snippet" t-thumbnail="/theme_custom/static/src/img/test_thumbnail.png"/> </xpath> </templates>
  • 17. Enterprise After upgrading the module, go to website and take the editor’s mode. Then, we can see the Test snippet under the Structure section
  • 18. Enterprise We can just drag and drop to any page where we need as we do with the default snippets in Odoo 17 website. Here, the snippet is dropped twice in our Test page
  • 19. Enterprise After completing these steps, your custom theme should be active on your Odoo 17 website. We can further customize the theme by adding more CSS, JavaScript, and adjusting the templates as needed. This kind of custom themes creation allows the developers to get the opportunity to tailor the website's appearance to specific requirements. By following the outlined steps, users can install, apply, and customize themes seamlessly within the Odoo framework. The process involves organizing files, defining page layouts, styling with CSS or SCSS, and incorporating custom snippets for enhanced website functionality.
  • 20. For More Info. Check our company website for related blogs and Odoo book. Check our YouTube channel for functional and technical videos in Odoo. Enterprise www.cybrosys.com