This question has been flagged

We are using the Odoo recruitment module and we we have CVs attached to applicants. When trying to access certain CVs this error keeps appearing:

OSError: [Errno 2] No such file or directory: '/opt/odoo/.local/share/Odoo/filestore/ZHRPM/2d/2d2955a5544e09c59860478be67a5ab5b5aac6f4' 

along with the Traceback. This appears to be completely random.

Going through the logs, we came across this:

Traceback (most recent call last):
File "/opt/odoo/odoo/openerp/addons/base/ir/ir_attachment.py", line 135, in _file_write
with open(full_path, 'wb') as fp:
IOError: [Errno 13] Permission denied: u'/opt/odoo/.local/share/Odoo/filestore/ZHRPM/2d/2d2955a5544e09c59860478be67a5ab5b5aac6f4'


Has anyone come across this before? What might be the reason for this to occur? How can we resolve it?

Thanks in advance.

Avatar
Discard

IOError and Permission denied errors usually come from the fact that an user does not have enough access rights on Ubuntu user level. Does your Ubuntu user that runs the Odoo process have enough rights to access/attach/download attachments?

Maybe still a little bit vague. The place where your filestore is kept (/opt/odoo/.local/share/Odoo/filestore) is probably restricted for the user where your Odoo process runs under in Linux.

Author

It was my understanding that the location for the filestore is created by Odoo itself and that the Odoo user has full permissions to write and read files to it. Is this not the case? Are there instances that this might change? I did a 'ls al' command on the filestore and it appeared that some of the files and folders had root ownership and some had Odoo ownership. But this is not the case in our development servers, where all the files and folders have Odoo ownership.

Best Answer

This is due to user permission of the user which runs odoo server, usually the user is "odoo".

You need to change the owner of the filestore folders

1) Check if odoo user is the owner:

user@HOST:~# sudo cd /var/lib/odoo/.local/share/                          
user@HOST:/var/lib/odoo/.local/share# sudo ls -la
total 12
drwx------ 3 root root 4096 Sep 22 2016 .
drwx------ 3 root root 4096 Sep 22 2016 ..
drwx------ 5 root root 4096 Apr 26 18:06 Odoo

2) Change the folder owner to proper user

user@HOST:/var/lib/odoo/.local/share# chown -R odoo: /var/lib/odoo
Avatar
Discard