From 4e507faaafdf5bd0a048106159663d01c820d866 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 16 Mar 2018 11:31:44 +0100 Subject: [PATCH] [FIX] web_editor: type of `res_id` - Set the demo user to have access to all quotations - Connect as demo, create a quote and send the message - In the message try to upload an image An access error is raised, although the user can write on the record. This is because the `res_id` received is a `string`, not an `int`. Therefore, the access check fails. Introduced with 6494f511718893eec3573c60c0a62e04d386359d opw-1824673 --- addons/web_editor/controllers/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/controllers/main.py b/addons/web_editor/controllers/main.py index cc8d91cbaef..c18978056f4 100644 --- a/addons/web_editor/controllers/main.py +++ b/addons/web_editor/controllers/main.py @@ -147,7 +147,10 @@ class Web_Editor(http.Controller): Attachments = request.env['ir.attachment'] # registry for the attachment table res_model = kwargs.get('res_model', 'ir.ui.view') - res_id = res_model != 'ir.ui.view' and kwargs.get('res_id') or None + if res_model != 'ir.ui.view' and kwargs.get('res_id'): + res_id = int(kwargs['res_id']) + else: + None uploads = [] message = None