How I can save attachments to file system?

Mohamed arif

The question has been closed

Ray Carnes
on 04/11/2013 14:50:20

In OpenERP 7, install module document. Now files can attach with records, but it saves in database. How I can change to save in file system?

In OpenERP 6, this can configure at Knowledge / Document Management / Storage Media. This is not found in OpenERP 7...?

2 Answers
Best Answer

This question has been answered several times. Search for: Where are document Attachments stored?

I'm quoting the answer:

In OpenERP v7, by default, attachments are stored in the database. You may choose to store them on the filesystem by setting an ir.config.parameter (Settings->Technical->Parameters-System parameters) named ir_attachment.location

Example if you set ir_attachment.location to file:///filestore

They will be stored in the filesystem at openerp root_path/filestore, the new system uses sha1 to generate the filename so that duplicate files don't take more space.

Only the file:/// scheme is implemented, modules can implement additional scheme like amazons3:///

In database mode the data is stored in ir_attachment.db_datas. Filestore mode file name is stored in ir_attachment.db_datas_fname.

Those names suck but we kept them for backwards compatibility.

No automatic conversion mechanism exists.

If you set this parameter existing attachments remain stored in the database, only NEW ones will be stored in the filesystem. But the system will try both location so it's not a problem (db_datas is checked first then db_datas_fname).

If you remove this parameter you should manually store back the files in the database because the system will only look in the database.