跳至内容
菜单
此问题已终结

Hi everyone,

I'm working on a use case where I want to store uploaded files coming from the document.manage model within the same server — without using S3 buckets, Google Cloud Storage, or any other external storage providers.

The requirement is to configure the storage location (path or directory) through a server-side configuration setting in Odoo, so that the file uploads are saved directly to a specified folder on the same server where Odoo is hosted.

If anyone has done something similar or can guide on the best practices for implementing this kind of local file storage in Odoo, I'd really appreciate the insights.

Thanks in advance!

形象
丢弃
编写者 最佳答案

We implemented custom file storage in Odoo by allowing users to define a local path through system settings. When a document is uploaded, it's saved to the specified path on the server using standard Python file handling:

os.makedirs(storage_path, exist_ok=True)

full_path = os.path.join(storage_path, filename)

with open(full_path, 'wb') as f:

    f.write(base64.b64decode(file_data))(creating copies of uploading documents and storing in new path does not make your server storage less it make double instead of this use below approach)

Instead of creating duplicate copies of documents in our new file path, we can use a separate OCA module called fs_attachment. This module allows us to configure a custom storage path and define which models and fields (document fields) should store files in that path.

Reference: https://apps.odoo.com/apps/modules/16.0/fs_attachment


This ensures documents are stored outside Odoo’s default filestore, giving more control over file organization and backup.
Thank You.

形象
丢弃
相关帖文 回复 查看 活动
0
2月 25
781
0
8月 25
334
0
8月 25
531
1
3月 25
1009
0
1月 25
995