Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
3941 Vistas

I have a app which stores an image file as an binary filed. when I tested it on odoo 14 (20211119) CE run in a docker container.The binary content was auto compress to an png format file. I have tested this for some times,I am sure about this.A elder version on local pc has no such phenomenon.

class XaserReport(models.Model):  

    _name = "xaser.report"
    source_img = fields.Binary('Image', attachment=True)



Avatar
Descartar

Did you find anything useful to stop this? This is bothering me

Mejor respuesta

It is possible that the behavior you are observing is related to the way Odoo is handling the storage of binary files. Odoo uses a filestore to store attachments, which can be configured to compress binary files to save disk space.

To check if this is the case, you can go to the Settings > Technical > Parameters > System Parameters menu in Odoo and look for the ir_attachment.location parameter. If the value is set to file, Odoo is using a filestore to store attachments, and it may be compressing your binary files to save disk space.

To disable compression, you can set the ir_attachment.location parameter to db, which will store attachments in the database instead of the filestore. However, storing attachments in the database can impact performance, so it's important to consider the tradeoffs before making this change.

Alternatively, you can try setting the image_type parameter to False in your fields.Binary definition to prevent the image from being automatically compressed. However, this may result in larger file sizes and impact performance if you are working with a large number of images.

It's also possible that the behavior you observed is related to the way the image was stored or generated before it was uploaded to Odoo. Without more information, it's difficult to determine the exact cause of the issue.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
ago 21
2746
1
may 25
1211
1
nov 24
868
1
may 20
2867
0
mar 20
2589