-
- Downloads
[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.
Showing
- addons/auth_signup/controllers/main.py 1 addition, 1 deletionaddons/auth_signup/controllers/main.py
- addons/auth_signup/models/res_partner.py 1 addition, 1 deletionaddons/auth_signup/models/res_partner.py
- addons/auth_signup/models/res_users.py 5 additions, 1 deletionaddons/auth_signup/models/res_users.py
- addons/website/__manifest__.py 2 additions, 0 deletionsaddons/website/__manifest__.py
- addons/website/controllers/backend.py 8 additions, 1 deletionaddons/website/controllers/backend.py
- addons/website/controllers/main.py 9 additions, 1 deletionaddons/website/controllers/main.py
- addons/website/data/website_data.xml 5 additions, 3 deletionsaddons/website/data/website_data.xml
- addons/website/data/website_demo.xml 2 additions, 62 deletionsaddons/website/data/website_demo.xml
- addons/website/models/__init__.py 1 addition, 0 deletionsaddons/website/models/__init__.py
- addons/website/models/ir_attachment.py 49 additions, 0 deletionsaddons/website/models/ir_attachment.py
- addons/website/models/ir_http.py 19 additions, 3 deletionsaddons/website/models/ir_http.py
- addons/website/models/ir_rule.py 12 additions, 0 deletionsaddons/website/models/ir_rule.py
- addons/website/models/ir_ui_view.py 149 additions, 3 deletionsaddons/website/models/ir_ui_view.py
- addons/website/models/res_company.py 16 additions, 0 deletionsaddons/website/models/res_company.py
- addons/website/models/res_config_settings.py 21 additions, 4 deletionsaddons/website/models/res_config_settings.py
- addons/website/models/res_partner.py 3 additions, 2 deletionsaddons/website/models/res_partner.py
- addons/website/models/res_users.py 41 additions, 1 deletionaddons/website/models/res_users.py
- addons/website/models/website.py 238 additions, 67 deletionsaddons/website/models/website.py
- addons/website/static/src/js/backend/dashboard.js 19 additions, 2 deletionsaddons/website/static/src/js/backend/dashboard.js
- addons/website/static/src/js/content/website_root.js 18 additions, 0 deletionsaddons/website/static/src/js/content/website_root.js
Loading
Please register or sign in to comment