diff options
| author | Jeremy Kersten <jke@odoo.com> | 2018-07-25 16:51:50 +0200 |
|---|---|---|
| committer | Jeremy Kersten <jke@odoo.com> | 2018-08-13 20:16:34 +0200 |
| commit | 066cfc9598a307a48b86104f4bf861a58de09b41 (patch) | |
| tree | d22a4c1336bc7e639c8afa35c9ffebf01d964475 /addons/website/controllers/backend.py | |
| parent | 8300155cd6133e0b8496cf4505081a1626e6f0aa (diff) | |
[IMP] website_[blog|event|forum|sale|slide]: make website specific
Set up env & tools for module website multiwebsite (blog, event, sale..)
website_id in modelConverter and ir_rule
add _compute_domain_keys to have a different cache per website
or rules would not be correctly website_dependant
eg: blog 1 on website 1, blog 2 on website 2
access blog 1 from website 1 => can access -> normal
access blog 1 from website 2 => can access -> should crash because (ir rule)
split mixing website.published.mixin and website.published.multi.mixin to have
website_id only on last one.
multi mixing will:
- override website_published compute to take current_website into account (not in backend)
- force website when clicking on published in backend
- website blog, website_sale, website_event, website_forum, website_slides are now multi website
Co-authored-by: Derie Romain <rde@odoo.com>
Co-authored-by: Kersten Jérémy <jke@odoo.com>
Diffstat (limited to 'addons/website/controllers/backend.py')
| -rw-r--r-- | addons/website/controllers/backend.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/addons/website/controllers/backend.py b/addons/website/controllers/backend.py index 3d75facfc30..d9ca7981612 100644 --- a/addons/website/controllers/backend.py +++ b/addons/website/controllers/backend.py @@ -31,6 +31,7 @@ class WebsiteBackend(http.Controller): if has_group_designer: config = request.env['res.config.settings'].sudo().create({}) + config.website_id = current_website if config.has_google_analytics_dashboard: dashboard_data['dashboards']['visits'] = dict( ga_client_id=config.google_management_client_id or '', # void string instead of stringified False @@ -39,7 +40,7 @@ class WebsiteBackend(http.Controller): return dashboard_data @http.route('/website/dashboard/set_ga_data', type='json', auth='user') - def website_set_ga_data(self, ga_client_id, ga_analytics_key): + def website_set_ga_data(self, website_id, ga_client_id, ga_analytics_key): if not request.env.user.has_group('base.group_system'): return { 'error': { @@ -54,10 +55,14 @@ class WebsiteBackend(http.Controller): 'message': 'The Google Analytics Client ID or Key you entered seems incorrect.', } } + Website = request.env['website'] + current_website = website_id and Website.browse(website_id) or Website.get_current_website() + request.env['res.config.settings'].create({ 'has_google_analytics': True, 'has_google_analytics_dashboard': True, 'google_management_client_id': ga_client_id, 'google_analytics_key': ga_analytics_key, + 'website_id': current_website, }).execute() return True |
