Base Attachment Object Store
by Camptocamp https://github.com/camptocamp/odoo-cloud-platform , Odoo Community Association (OCA) https://github.com/camptocamp/odoo-cloud-platformAvailability |
Odoo Online
Odoo.sh
On Premise
|
Lines of code | 255 |
Technical Name |
base_attachment_object_storage |
License | AGPL-3 |
Website | https://github.com/camptocamp/odoo-cloud-platform |
Versions | 7.0 8.0 9.0 10.0 11.0 12.0 |
Base class for attachments on external object store
This is a base addon that regroup common code used by addons targeting specific object store
Configuration
Object storage may be slow, and for this reason, we want to store some files in the database whatever.
Small images (128, 256) are used in Odoo in list / kanban views. We want them to be fast to read. They are generally < 50KB (default configuration) so they don't take that much space in database, but they'll be read much faster than from the object storage.
The assets (application/javascript, text/css) are stored in database as well whatever their size is:
- a database doesn't have thousands of them
- of course better for performance
- better portability of a database: when replicating a production instance for dev, the assets are included
This storage configuration can be modified in the system parameter ir_attachment.storage.force.database, as a JSON value, for instance:
{"image/": 51200, "application/javascript": 0, "text/css": 0}
Where the key is the beginning of the mimetype to configure and the value is the limit in size below which attachments are kept in DB. 0 means no limit.
Default configuration means:
- images mimetypes (image/png, image/jpeg, ...) below 50KB are stored in database
- application/javascript are stored in database whatever their size
- text/css are stored in database whatever their size
Please log in to comment on this module