summaryrefslogtreecommitdiff
path: root/addons/web_editor/controllers/main.py
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2018-09-28 14:50:18 +0200
committerqsm-odoo <qsm@odoo.com>2018-09-30 19:55:17 +0200
commit55131b8f5becdd3d4776f4c3e7e4288a0b185706 (patch)
tree4eca54d0cd14a2180227ad2b155e3380d37fb9a6 /addons/web_editor/controllers/main.py
parentfeae553b98c88282695c77382f4a52c78b3f8f70 (diff)
[REF] website, *: add automatic context for call_kw rpc
* web_editor, website_blog, website_crm_partner_assign, website_links, website_livechat, website_mail_channel, website_mass_mailing, website_slides Calling a model's method thanks to an RPC will now always send the web_editor context automatically, making sure the method gets the website_id all the time, removing the need to guess the current website (now the get_current_website method uses the context website_id if any). Note: other routes already have the website_id via request.env.context if they correctly set website=True (this commit also adds website=True for scss files customization routes).
Diffstat (limited to 'addons/web_editor/controllers/main.py')
-rw-r--r--addons/web_editor/controllers/main.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/addons/web_editor/controllers/main.py b/addons/web_editor/controllers/main.py
index 13a633b5951..2eba6fff81e 100644
--- a/addons/web_editor/controllers/main.py
+++ b/addons/web_editor/controllers/main.py
@@ -140,7 +140,7 @@ class Web_Editor(http.Controller):
#------------------------------------------------------
# add attachment (images or link)
#------------------------------------------------------
- @http.route('/web_editor/attachment/add', type='http', auth='user', methods=['POST'])
+ @http.route('/web_editor/attachment/add', type='http', auth='user', methods=['POST'], website=True)
def attach(self, upload=None, url=None, disable_optimization=None, filters=None, **kwargs):
# the upload argument doesn't allow us to access the files if more than
# one file is uploaded, as upload references the first file
@@ -215,7 +215,7 @@ class Web_Editor(http.Controller):
#------------------------------------------------------
# remove attachment (images or link)
#------------------------------------------------------
- @http.route('/web_editor/attachment/remove', type='json', auth='user')
+ @http.route('/web_editor/attachment/remove', type='json', auth='user', website=True)
def remove(self, ids, **kwargs):
""" Removes a web-based image attachment if it is used by no view (template)
@@ -249,7 +249,7 @@ class Web_Editor(http.Controller):
## This route is used from CropImageDialog to get image info.
## It is used to display the original image when we crop a previously
## cropped image
- @http.route('/web_editor/get_image_info', type='json', auth='user')
+ @http.route('/web_editor/get_image_info', type='json', auth='user', website=True)
def get_image_info(self, image_id=None, xml_id=None):
if xml_id:
record = request.env.ref(xml_id)
@@ -390,7 +390,7 @@ class Web_Editor(http.Controller):
## @param url - the original url of the scss file which has to be modified
## @param bundle_xmlid - the xmlid of the bundle in which the scss file addition can be found
## @param content - the new content of the scss file
- @http.route("/web_editor/save_scss", type="json", auth="user")
+ @http.route("/web_editor/save_scss", type="json", auth="user", website=True)
def save_scss(self, url, bundle_xmlid, content):
IrAttachment = request.env["ir.attachment"]
@@ -444,7 +444,7 @@ class Web_Editor(http.Controller):
## The reset_scss route is in charge of reverting all the changes that were done to a scss file.
## @param url - the original URL of the scss file to reset
## @param bundle_xmlid - the xmlid of the bundle in which the scss file addition can be found
- @http.route("/web_editor/reset_scss", type="json", auth="user")
+ @http.route("/web_editor/reset_scss", type="json", auth="user", website=True)
def reset_scss(self, url, bundle_xmlid):
custom_url = self._make_custom_scss_file_url(url, bundle_xmlid)