summaryrefslogtreecommitdiff
path: root/addons/website/controllers/web_editor.py
diff options
context:
space:
mode:
authorJeremy Kersten <jke@odoo.com>2018-09-25 16:12:47 +0200
committerJeremy Kersten <jke@odoo.com>2018-09-25 19:40:42 +0200
commit44d659d0df6b50ae230af39a0d41a46b9549e2ae (patch)
tree99827198d8263e9e643fd0b03a44cc918b46ff2f /addons/website/controllers/web_editor.py
parent569554b9e035c638d57b63740cd9141634508a14 (diff)
[FIX] web_editor,website: add hook method in web editor to allow to add the website_id
Before this commit, the view create by editor (to change the scss file in asset for example) was not website specific. Now we override (use the new hook method) to add the website_id.
Diffstat (limited to 'addons/website/controllers/web_editor.py')
-rw-r--r--addons/website/controllers/web_editor.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/addons/website/controllers/web_editor.py b/addons/website/controllers/web_editor.py
new file mode 100644
index 00000000000..d70e912018b
--- /dev/null
+++ b/addons/website/controllers/web_editor.py
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+from odoo.addons.web_editor.controllers.main import Web_Editor
+from odoo.http import request
+
+
+class Web_Editor(Web_Editor):
+
+ def save_scss_view_hook(self):
+ res = super(Web_Editor, self).save_scss_view_hook()
+
+ website = request.env['website'].get_current_website()
+ if website:
+ res['website_id'] = website.id
+ return res
+
+ def save_scss_attachment_hook(self):
+ res = super(Web_Editor, self).save_scss_attachment_hook()
+
+ website = request.env['website'].get_current_website()
+ if website:
+ res['website_id'] = website.id
+ return res
+
+ def get_custom_attachment(self, custom_url, op='like'):
+ website = request.env['website'].get_current_website()
+ res = super(Web_Editor, self).get_custom_attachment(custom_url, op=op)
+ return res.with_context(website_id=website.id).filtered(lambda x: not x.website_id or x.website_id == website)
+
+ def get_custom_view(self, custom_url, op='='):
+ website = request.env['website'].get_current_website()
+ res = super(Web_Editor, self).get_custom_view(custom_url, op=op)
+ return res.with_context(website_id=website.id).filter_duplicate()