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/web_editor/controllers/main.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'addons/web_editor/controllers/main.py') diff --git a/addons/web_editor/controllers/main.py b/addons/web_editor/controllers/main.py index 7dbc3415f21..9509a541c88 100644 --- a/addons/web_editor/controllers/main.py +++ b/addons/web_editor/controllers/main.py @@ -146,6 +146,9 @@ class Web_Editor(http.Controller): # therefore we have to recover the files from the request object Attachments = request.env['ir.attachment'] # registry for the attachment table + website = request.env['website'].get_current_website() # # TO MOVE + + res_model = kwargs.get('res_model', 'ir.ui.view') if res_model != 'ir.ui.view' and kwargs.get('res_id'): res_id = int(kwargs['res_id']) @@ -167,6 +170,8 @@ class Web_Editor(http.Controller): 'public': res_model == 'ir.ui.view', 'res_id': res_id, 'res_model': res_model, + 'website_id': website.id, + }) attachment.generate_access_token() uploads += attachment.read(['name', 'mimetype', 'checksum', 'url', 'res_id', 'res_model', 'access_token']) @@ -198,6 +203,8 @@ class Web_Editor(http.Controller): 'public': res_model == 'ir.ui.view', 'res_id': res_id, 'res_model': res_model, + 'website_id': website.id, # TO MOVE IN WEBSITEID + }) attachment.generate_access_token() attachments += attachment -- cgit v1.2.3