From 4f6ec1cd2a9253bb0c6c17d304490c7809facf8a Mon Sep 17 00:00:00 2001 From: Joren Van Onder Date: Sun, 12 Aug 2018 22:40:50 +0200 Subject: [IMP] website,*: support multiple websites This implements support to administer multiple websites. Although the core functionality already existed, managing multiple websites was fairly technical. In the interest of database updates and migration this attempts to keep duplicated data to a minimum. To do this the usual generic records are rendered unless some website-specific record exists that replaces it. Copy-on-write (COW) is used to create these website-specific records. Through this mechanism creating a website-specific record is delayed until necessary. A COW mechanism has been implemented on 4 models: ir.ui.view, website.page, website.menu and ir.attachment. These COW mechanisms are activated when editing data through the website (aka frontend). These frontend edits (e.g. with web_editor) will be website-specific, possibly creating a website-specific record when necessary. When editing data in the backend nothing special will happen, even when editing a generic record. Note that because of this mechanism also facilitates the ability to create new, uncustomized websites because the generic data is kept. Support is provided for a website to have any theme. Themes are fairly complex to handle. Standalone themes can depend on other standalone themes (e.g. theme_beauty depends on theme_loftspace) and themes usually modify some data of the themes they depend on. Because a theme can be installed on multiple websites, using website_id m2o fields does not work well. It would require duplicate data, making updates and migration harder. Because of this, data for themes (ir.ui.view and ir.attachment specifically) have a theme_id m2o. website has a theme_ids m2m that identifies all theme modules currently installed on it. Through these fields we figure out what to render. A theme is only fully uninstalled when it's no longer active on any website. The advantage of this approach is that upgrading or migrating theme data is no different from the single-website case. The website.published.mixin class was modified to handle multiple websites. A wizard was added in the backend to easily manage this for multiple website. Although not used anywhere in this commit, a 'website_id' variable has been added in the evaluation context of ir.rule. It allows to easily make any model multi-website aware, all that's needed is a custom website_id m2o field on a model and a custom record rule. --- addons/website_theme_install/models/__init__.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'addons/website_theme_install/models/__init__.py') diff --git a/addons/website_theme_install/models/__init__.py b/addons/website_theme_install/models/__init__.py index de58fda6e31..786d2febfb6 100644 --- a/addons/website_theme_install/models/__init__.py +++ b/addons/website_theme_install/models/__init__.py @@ -2,3 +2,5 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import ir_module_module +from . import ir_ui_view +from . import res_config_settings -- cgit v1.2.3 From c0968e68eda55df624fb94016d036a2af598b10c Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Sun, 12 Aug 2018 23:17:24 +0200 Subject: [ADD] website_theme_install: try to make theme multi website compliant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From now, when you install a theme, it load the data from xml to template table theme [ir.ui.view|ir.attachment|website.page|website.menu]. Data are only copied from this template table into the real table when you choose a theme on a website; Making them website_specific and with a link to the original to allow futur update. A special case is done to create theme.ir.ui.view when you are installing a theme, even if you continue to use template tag to create quick view. Co-authored-by: Derie Romain Co-authored-by: Kersten Jérémy --- addons/website_theme_install/models/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'addons/website_theme_install/models/__init__.py') diff --git a/addons/website_theme_install/models/__init__.py b/addons/website_theme_install/models/__init__.py index 786d2febfb6..0e35edfc5eb 100644 --- a/addons/website_theme_install/models/__init__.py +++ b/addons/website_theme_install/models/__init__.py @@ -2,5 +2,7 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import ir_module_module -from . import ir_ui_view +from . import res_company from . import res_config_settings +from . import theme_models +from . import website -- cgit v1.2.3