Creating an Odoo theme using scaffolding

To create an Odoo theme you basically use the same structure as any other Odoo module. You will need a main folder to hold your theme files. This folder should be named theme_ followed by the name of your theme.
Fortunately, you can use scaffolding to create a template for your module so you don't have to create all the files from scratch. To create our custom theme use the following command in a Terminal window. Make sure you are in the directory that contains odoo-bin and that you use the correct name for your custom add-on directory.

./odoo-bin scaffold -t theme "Silkworm Theme" custommodules

The scaffolding includes references to empty files inside the __manifest__.py file. Go in and clear out these references so your file looks like the following:

{
# Theme information
'name': "Silkworm Theme",
'description': """ A custom theme example
""",
'category': 'Theme/Creative',
'version': '1.0',
'depends': ['website'],

# templates
'data': [
],

# Your information
'author': "Your Name",
'website': "",
}

Specifically, we have removed references to the options.xml and snipets.xml files.

You can now restart the Odoo server and refresh the app list. The Silkworm Theme will now appear ready to install. You can now Install the theme and make sure there are no errors with the basic template:

Let's see how a layout.xml file is used to add new elements to the Odoo header.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.131.38.219