diff --git a/content/developer/howtos/website_themes/pages.rst b/content/developer/howtos/website_themes/pages.rst index fa2de2e7e..891ab54d6 100644 --- a/content/developer/howtos/website_themes/pages.rst +++ b/content/developer/howtos/website_themes/pages.rst @@ -179,13 +179,42 @@ With `` you use the Odoo default page layout with you `noupdate` attribute -------------------- -This attribute prevents data overwriting. +This attribute prevents data overwriting. It can be added either on a `data` tag wrapping some +records to protect or on the `odoo`tag` in order to protect all records declared into the file. + +Protect all records of the file: .. code-block:: xml - - - + + + + + + + + + + +Protect specific records in the file: + +.. code-block:: xml + + + + + + + + + + + + + + + + **Use case** @@ -201,8 +230,8 @@ those existing in the database even if the end-user has changed some of these re **Solution** By wrapping the record (or all records declared in the file) into a `` -tag, the record declared is created at -the first module installation but not updated after a module update. +tag, the record declared is created at the first module installation but not updated after a module +update. .. spoiler:: What happens if the record has been manually deleted (e.g.: a menu item) ? @@ -234,3 +263,114 @@ Make the header background transparent and stand on top of the page content. - `Bootstrap cheat sheet `_ - `Bootstrap documentation `_ + +.. _website_themes/pages/theme_pages/page_templates : + +Page templates +-------------- + +Create preset static page templates available from the New Page dialog window. + +**Declaration** + +The page templates has to be defined into the :file:`__manifest__.py` of the module through +`new_page_templates`: + +.. code-block:: python + :caption: `/website_airproof/__manifest__.py` + :emphasize-lines: 15-18 + + { + 'name': 'Airproof Theme', + 'description': '...', + 'category': 'Website/Theme', + 'version': '17.0.0', + 'author': '...', + 'license': '...', + 'depends': ['website'], + 'data': [ + # ... + ], + 'assets': { + # ... + }, + 'new_page_templates': { + 'airproof': { + 'faq': ['s_airproof_text_block_h1', 's_title', 's_faq_collapse', 's_call_to_action'] + } + } + +**Templates** + +Then you have to create the template using a specific naming convention based on the hierarchy into +the :file:`__manifest__.py`. In this case, the name is `new_page_template_sections_airproof_faq`. +The building blocks called in this template are exactly the same as the standard ones except for +the first that has been adapted "on the fly". + +Create a new instance of the standard `s_text_block` (`primary` attribute is important) and apply some +adaptations: + +.. code-block:: xml + :caption: `/website_airproof/views/new_page_template_templates.xml` + + + +Instantiate each building block (modified or not) for the page template: + +.. code-block:: xml + :caption: `/website_airproof/views/new_page_template_templates.xml` + +