diff --git a/addons/web_editor/controllers/main.py b/addons/web_editor/controllers/main.py index 012082b332b..13a633b5951 100644 --- a/addons/web_editor/controllers/main.py +++ b/addons/web_editor/controllers/main.py @@ -452,13 +452,13 @@ class Web_Editor(http.Controller): self.get_custom_attachment(custom_url).unlink() self.get_custom_view(custom_url).unlink() - def get_custom_attachment(self, custom_url, op='like'): - assert op in ('like', '=like', '='), 'Invalid operator' + def get_custom_attachment(self, custom_url, op='='): + assert op in ('=like', '='), 'Invalid operator' IrAttachment = request.env["ir.attachment"] return IrAttachment.search([("url", op, custom_url)]) def get_custom_view(self, custom_url, op='='): - assert op in ('like', '=ilike', '='), 'Invalid operator' + assert op in ('=like', '='), 'Invalid operator' IrUiView = request.env["ir.ui.view"] return IrUiView.search([("name", op, custom_url)]) diff --git a/addons/website/controllers/web_editor.py b/addons/website/controllers/web_editor.py index d70e912018b..93c3aa46007 100644 --- a/addons/website/controllers/web_editor.py +++ b/addons/website/controllers/web_editor.py @@ -22,7 +22,7 @@ class Web_Editor(Web_Editor): res['website_id'] = website.id return res - def get_custom_attachment(self, custom_url, op='like'): + def get_custom_attachment(self, custom_url, op='='): 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) diff --git a/odoo/addons/base/models/ir_qweb.py b/odoo/addons/base/models/ir_qweb.py index 8924e003629..18717316f57 100644 --- a/odoo/addons/base/models/ir_qweb.py +++ b/odoo/addons/base/models/ir_qweb.py @@ -314,7 +314,8 @@ class IrQWeb(models.AbstractModel, QWeb): edit_translations=False, translatable=False, rendering_bundle=True) - env = self.env(context=options) + options['website_id'] = self.env.context.get('website_id') + IrQweb = self.env['ir.qweb'].with_context(options) def can_aggregate(url): return not urls.url_parse(url).scheme and not urls.url_parse(url).netloc and not url.startswith('/web/content') @@ -327,7 +328,7 @@ class IrQWeb(models.AbstractModel, QWeb): from odoo.addons.web.controllers.main import module_boot return json.dumps(module_boot()) return '[]' - template = env['ir.qweb'].render(xmlid, {"get_modules_order": get_modules_order}) + template = IrQweb.render(xmlid, {"get_modules_order": get_modules_order}) files = [] remains = []