Create a theme module

Odoo’s themes are packaged like modules. Even if you are designing a very simple website for your company or client, you need to package the theme like an Odoo module.

main folder

Create a folder and name it like this:theme_followed by your theme's name.

__manifest__.py

Create an empty document and save it to your folder as__manifest__.py. This will contain the configuration info for your theme.

__init__.py

Create another empty file and name it__init__.py. It's a mandatory system file. Create and leave it blank.

viewsandstaticfolders

Create them in the main folder. Inviewsyou'll place your xml files that define your snippets, your pages and your options.staticfolder is the right place for your style , images and custom js code.

Important

Use two underscore characters at the beginning and two at the end of odoo and init file names.

The final result should be something like this:

Edit__manifest__.py

Open the__manifest__.pyyou created and copy/paste the following:

{
  'name':'Tutorial theme',
  'description': 'A description for your theme.',
  'version':'1.0',
  'author':'Your name',

  'data': [
  ],
  'category': 'Theme/Creative',
  'depends': ['website'],
}

Replace the first four property’s values with anything you like. These values will be used to identify your new theme in Odoo’s backend.

Thedataproperty will contain the xml files list. Right now it’s empty, but we will add any new files created.

application: Trueis mandatory.

categorydefines your module category (always “Theme”) and, after a slash, the subcategory. You can use one subcategory from the Odoo Apps categories list. (https://www.odoo.com/apps/themes)

dependsspecifies the modules needed by our theme to work properly. For our tutorial theme, we only need website. If you need blogging or eCommerce features as well, you have to add those modules too.

...
'depends': ['website', 'website_blog', 'sale'],
...

Installing your theme

To install your theme, you just place your theme folder inside addons in your Odoo installation.

After that, navigate to the Settings page, look for your theme and click on the install button.

results matching ""

    No results matching ""