From 907d9efa4e4401b291cc3e347d8909de129b07b1 Mon Sep 17 00:00:00 2001 From: Brandon Mercier <113701731+bram-odoo@users.noreply.github.com> Date: Fri, 21 Mar 2025 16:25:00 +0000 Subject: [PATCH] [IMP/ADD] website_themes: "Pages" page update - New static page template mechanism; - Replace the header_overlay screenshot - Update the noattribute for 17.0 closes odoo/documentation#12631 X-original-commit: e99d444827bc736895967f294d7ccc8c3b9ce384 Signed-off-by: Brandon Mercier (bram) --- .../developer/howtos/website_themes/pages.rst | 152 +++++++++++++++++- .../website_themes/pages/header-overlay.png | Bin 133650 -> 466616 bytes .../pages/new-page-template.png | Bin 0 -> 59595 bytes 3 files changed, 146 insertions(+), 6 deletions(-) create mode 100644 content/developer/howtos/website_themes/pages/new-page-template.png 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` + +