summaryrefslogtreecommitdiff
path: root/addons/website/data/website_data.xml
diff options
context:
space:
mode:
authorJoren Van Onder <jov@odoo.com>2018-08-12 22:40:50 +0200
committerJeremy Kersten <jke@odoo.com>2018-08-13 19:51:10 +0200
commit4f6ec1cd2a9253bb0c6c17d304490c7809facf8a (patch)
tree3ef047b311595b8f89d74adf90b2f891e7bba2a3 /addons/website/data/website_data.xml
parent5ff87e8039676db5a0c48422998d0cabd556a12d (diff)
[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.
Diffstat (limited to 'addons/website/data/website_data.xml')
-rw-r--r--addons/website/data/website_data.xml8
1 files changed, 5 insertions, 3 deletions
diff --git a/addons/website/data/website_data.xml b/addons/website/data/website_data.xml
index cc82e1d40ee..2c5c131f5e7 100644
--- a/addons/website/data/website_data.xml
+++ b/addons/website/data/website_data.xml
@@ -11,7 +11,6 @@
<record id="main_menu" model="website.menu">
<field name="name">Top Menu</field>
- <field name="website_id" ref="default_website"/>
</record>
<record id="menu_homepage" model="website.menu">
@@ -19,7 +18,6 @@
<field name="url">/</field>
<field name="parent_id" ref="website.main_menu"/>
<field name="sequence" type="int">10</field>
- <field name="website_id" ref="default_website"/>
</record>
<record id="menu_contactus" model="website.menu">
@@ -27,7 +25,6 @@
<field name="url">/contactus</field>
<field name="parent_id" ref="website.main_menu"/>
<field name="sequence" type="int">60</field>
- <field name="website_id" ref="default_website"/>
</record>
<!-- split between ir_ui_view & website_page record to keep external_id on ir_ui_view -->
@@ -579,4 +576,9 @@
<field name="url">/website/static/src/img/snippets_demo/s_team_member_4.png</field>
</record>
</data>
+ <data>
+ <record id="group_multi_website" model="res.groups">
+ <field name="name">Multi-website</field>
+ </record>
+ </data>
</odoo>