diff --git a/fs_file/fields.py b/fs_file/fields.py index 3dc2e8e4c6..62edebfe67 100644 --- a/fs_file/fields.py +++ b/fs_file/fields.py @@ -386,7 +386,7 @@ def convert_to_cache(self, value, record, validate=True): # we come from an onchange # The id is the third element of the url att_id = value["url"].split("/")[3] - attachment = record.env["ir.attachment"].browse(int(att_id)) + attachment = record.env["ir.attachment"].sudo().browse(int(att_id)) return self._convert_attachment_to_cache(attachment) return FSFileValue( name=value["filename"], value=base64.b64decode(value["content"]) diff --git a/fs_file/readme/newsfragments/288.bugfix b/fs_file/readme/newsfragments/288.bugfix new file mode 100644 index 0000000000..79e4bb3b50 --- /dev/null +++ b/fs_file/readme/newsfragments/288.bugfix @@ -0,0 +1,6 @@ +Browse attachment with sudo() to avoid read access errors + +In models that have a multi fs image relation, a new line +in form will trigger onchanges and will call the fs.file model +'convert_to_cache()' method that will try to browse the attachment +with user profile that could have no read rights on attachment model.