Where are document Attachments stored?

Most forms allows you to add Attachments.

Where are these attachments stored? Somewhere in the database, or maybe somewhere in the server's file system?

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.

Need more info?

This documentation page has been extracted from the Q&A section where you can discuss it and get feedback.
Related question