Skip to content

Commit

Permalink
[FIX] web_editor: type of res_id
Browse files Browse the repository at this point in the history
- 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 6494f51

opw-1824673
  • Loading branch information
nim-odoo committed Mar 16, 2018
1 parent 00057f8 commit 4e507fa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion addons/web_editor/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ def attach(self, func, upload=None, url=None, disable_optimization=None, **kwarg
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
Expand Down

0 comments on commit 4e507fa

Please sign in to comment.