[FIX] base: fixes previous fix

In fix e248882, the previous elif statement prevented the
execution of the fix code. This fix fixes the fix.
This commit is contained in:
Damien Bouvy
2016-04-26 08:12:33 +02:00
parent e1ed2c6ddc
commit ccd7a15709
+1 -1
View File
@@ -300,7 +300,7 @@ class ir_http(osv.AbstractModel):
mimetype = obj.mimetype
elif filename:
mimetype = mimetypes.guess_type(filename)[0]
elif getattr(env[model]._fields[field], 'attachment', False):
if not mimetype and getattr(env[model]._fields[field], 'attachment', False):
# for binary fields, fetch the ir_attachement for mimetype check
attach_mimetype = env['ir.attachment'].search_read(domain=[('res_model', '=', model), ('res_id', '=', id), ('res_field', '=', field)], fields=['mimetype'], limit=1)
mimetype = attach_mimetype and attach_mimetype[0]['mimetype']