From 5f9c8ced24ac1c8a65c04f745ad2ea3bb1125c99 Mon Sep 17 00:00:00 2001 From: Ivan Yelizariev Date: Tue, 24 Apr 2018 15:08:54 +0000 Subject: [PATCH] [FIX] base: keep mimetypes after force_storage The write override recomputed the mimetype when changing the datas It may give a different result closes odoo/odoo#24397 Signed-off-by: Martin Trigaux (mat) --- odoo/addons/base/models/ir_attachment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/odoo/addons/base/models/ir_attachment.py b/odoo/addons/base/models/ir_attachment.py index a58ba54c448..4ccdc29b184 100644 --- a/odoo/addons/base/models/ir_attachment.py +++ b/odoo/addons/base/models/ir_attachment.py @@ -65,7 +65,8 @@ class IrAttachment(models.Model): }[self._storage()] for attach in self.search(domain): - attach.write({'datas': attach.datas}) + # pass mimetype, to avoid recomputation + attach.write({'datas': attach.datas, 'mimetype': attach.mimetype}) return True @api.model