diff --git a/doc/howtos/theme_tutorial_assets/img/folder.jpg b/doc/howtos/theme_tutorial_assets/img/folder.jpg deleted file mode 100755 index af2acb93d56..00000000000 Binary files a/doc/howtos/theme_tutorial_assets/img/folder.jpg and /dev/null differ diff --git a/doc/howtos/theme_tutorial_assets/img/theme_folder.jpg b/doc/howtos/theme_tutorial_assets/img/theme_folder.jpg new file mode 100755 index 00000000000..066e85c6158 Binary files /dev/null and b/doc/howtos/theme_tutorial_assets/img/theme_folder.jpg differ diff --git a/doc/howtos/themes.rst b/doc/howtos/themes.rst index efa47c48ec1..5cdfd20181e 100644 --- a/doc/howtos/themes.rst +++ b/doc/howtos/themes.rst @@ -4,6 +4,13 @@ Theme Tutorial ===================== +.. warning:: + + This tutorial provides a great overview of what you can do creating an + Odoo theme. It is however incomplete. We are currently working on a new + detailed theme tutorial, come back here soon to unleash the true power of + Odoo themes! + .. rst-class:: lead Odoo celebrates freedom. Freedom for the designer to go further and @@ -18,11 +25,7 @@ An introduction for web designers ================================= If you are a web designer using Odoo for the first time, you are in the right place. -This introduction will outline the basics of Odoo theme creation. - -.. note:: - - Odoo’s team has created a framework that’s powerful and easy to use. There’s no need to know special syntaxes to use this set of tools. +This introduction will outline the basics of Odoo theme creation. Odoo’s team has created a framework that’s powerful and easy to use. From common CMS to Odoo ----------------------- @@ -60,8 +63,8 @@ Odoo default theme structure .. container:: col-sm-8 - Odoo comes with a default theme structure. - It is a very basic “theme” that provides minimal structure and layout. When you create a new theme, you are actually extending this. + Odoo comes with a default website structure. + It is a very basic “theme” that provides minimal structure and layout. When you create a new theme, you are actually **extending** this. Indeed it’s always enabled in your setup and it acts exactly like the CMS’s base structure we mentioned above, except that you don’t have to create or maintain it. It will upgrade automatically within your Odoo installation and, since it is included in the Website Builder module, everything is smoothly integrated by default. @@ -77,10 +80,10 @@ Odoo default theme structure **Main features:** - * Basic layouts for pages, blog and eCommerce + * Basic layouts for pages, blog, eCommerce and much more * Website Builder integration * Basic Snippets - * Automatic Less/Sass compiling + * Automatic Sass compiling * Automatic Js and CSS minification and combination .. container:: col-md-6 @@ -99,10 +102,10 @@ An Odoo theme is not a folder containing HTML or PHP files, it’s a modular fra Using classical web design workflows, you usually code the layout of the entire page. The result of this is a “static” web page. You can update the content, of course, but your client will need you to work on making even basic changes. -Creating themes for Odoo is a total change of perspective. Instead of defining the complete layout for a page, you can create blocks (snippets) at let the user choose where to “drag&drop” them, creating the page layout on their own. +Creating themes for Odoo is a total change of perspective. Instead of defining the complete layout for a page, you can create blocks (snippets) and let the user choose where to “drag&drop” them, creating the page layout on their own. We call this modular design. -Imagine an Odoo theme as a “list” of elements and options that you have to create and style. +Imagine an Odoo theme as a “list” of elements and options that you have to create or extend. As a designer, your goal is to style these elements in order to achieve a wonderful result, regardless of where the end user chooses to place them. Let’s take a tour of our “list” elements: @@ -134,7 +137,7 @@ Let’s take a tour of our “list” elements: Styles - Styles are defined using standard CSS files (or Less/Sass). You can define a style as **default** or **optional**. The default styles are always active in your theme, the optional styles can be enabled or disabled by the user. + Styles are defined using SCSS files (or you can use standard CSS files). You can define a style as **default** or **optional**. The default styles are always active in your theme, the optional styles can be enabled or disabled by the user. .. figure:: theme_tutorial_assets/img/functionalities.jpg :figclass: col-sm-6 @@ -183,24 +186,6 @@ the **Odoo default structure**. In order to do that you can use Keep reading the tutorial to learn to how properly extend it with your own code. -Update your theme ------------------ - -.. container:: row - - .. container:: col-sm-6 - - Since XML files are only loaded when you install the theme, you will have to force reloading every time you make changes on an xml file. - - To do that, click on the Upgrade button in the module’s page. - - .. image:: theme_tutorial_assets/img/restart.png - - .. container:: col-sm-5 - - .. image:: theme_tutorial_assets/img/upgrade_module.png - - Create a theme module ====================== @@ -231,9 +216,9 @@ Odoo’s themes are packaged like modules. Even if you are designing a very simp 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: +The final result should be like this: -.. image:: theme_tutorial_assets/img/folder.jpg +.. image:: theme_tutorial_assets/img/theme_folder.jpg Edit ``__manifest__.py`` ------------------------ @@ -242,34 +227,32 @@ Open the ``__manifest__.py`` you created and copy/paste the following: .. code-block:: python - { - 'name':'Tutorial theme', - 'description': 'A description for your theme.', - 'version':'1.0', - 'author':'Your name', + { + 'name': 'Tutorial theme', + 'description': 'A description for your theme.', + 'version': '1.0', + 'author': 'Your name', + 'category': 'Theme/Creative', - 'data': [ - ], - 'category': 'Theme/Creative', - 'depends': ['website', 'website_theme_install'], - } + 'depends': ['website', 'website_theme_install'], + 'data': [ + ], + } 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. -The ``data`` property will contain the xml files list. Right now it’s empty, but we will add any new files created. - ``category`` defines 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) - -``depends`` specifies the modules needed by our theme to work properly. For our tutorial theme, we only need website and website_theme_install to install/update. If you need blogging or eCommerce features as well, you have to add those modules too. +``depends`` specifies the modules needed by our theme to work properly. For our tutorial theme, we only need website and website_theme_install to install/update. +If you need blogging or eCommerce features as well, you have to add those modules too. +If you plan to offer your theme to the majority of users, it is however recommended that you only depend on website and website_theme_install for the base of your theme. You can then create a second theme, which is an extension of the first one and another Odoo feature like the eCommerce. .. code-block:: python - ... - 'depends': ['website', 'website_theme_install', 'website_blog', 'sale'], - ... + 'depends': ['theme_tutorial', 'website_sale'], +The ``data`` property will contain the xml files list. Right now it’s empty, but we will add any new files created. Installing your theme @@ -283,6 +266,15 @@ After that, navigate to the Odoo **Website** module, go to Under **Website** section click the **Pick a Theme** button, then hover over your theme and click **Use this theme**. +Update your theme +----------------- + +Since XML files are only loaded when you install the theme, you will have to force reloading every time you make changes on an xml file. + +To do that, click on the Upgrade button in the theme selection screen. + +.. image:: theme_tutorial_assets/img/restart.png + Structure of an Odoo page ========================= @@ -296,48 +288,216 @@ By default, Odoo provides you with a **Header** and a **Footer** (cross-pages) a .. image:: theme_tutorial_assets/img/page_structure.jpg To inspect the default layout, simply create a new page using the -Website Builder. Click on :menuselection:`Content --> New Page` and +Website Builder. Click on :menuselection:`New --> New Page` and add a page name. Inspect the page using your browser. .. code-block:: html -
- Lorem ipsum dolor sit amet, consectetur adipiscing elit.
-
- Lorem ipsum dolor sit amet, consectetur adipiscing elit.
-
- Lorem ipsum dolor sit amet, consectetur adipiscing elit.
-
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+