[FIX] #1526 - Missing filename on binary fields download
This commit is contained in:
parent
25e11113b5
commit
1737ae3dd6
|
@ -1090,9 +1090,14 @@ class Binary(http.Controller):
|
|||
if not filecontent:
|
||||
return request.not_found()
|
||||
else:
|
||||
filename = '%s_%s' % (model.replace('.', '_'), id)
|
||||
if filename_field:
|
||||
filename = res.get(filename_field, '') or filename
|
||||
filename = res.get(filename_field, '')
|
||||
if not filename:
|
||||
# based on https://bugs.launchpad.net/openerp-web/+bug/1252458
|
||||
filename_name = Model.read([int(id)], [filename_field], context)
|
||||
filename = filename_name and filename_name[0] and filename_name[0][filename_field] or False
|
||||
if not filename:
|
||||
filename = '%s_%s' % (model.replace('.', '_'), id)
|
||||
return request.make_response(filecontent,
|
||||
[('Content-Type', 'application/octet-stream'),
|
||||
('Content-Disposition', content_disposition(filename))])
|
||||
|
|
Loading…
Reference in New Issue