odoo/odoo — pull request #4294 by bwrsandman (2014-12-17 14:44:00+00:00)
Title: [8.0] [IMP] Add the corresponding content type document instead the default content type

Forward port of 7.0 PR: https://github.com/odoo/odoo/pull/1229
Issue: https://github.com/odoo/odoo/issues/1225

Description
---

When an attachment is downloaded from a model page, Odoo set the content-type value to 'application/octet-stream'. This cause the browser to directly download the file instead of suggesting alternative options, like opening it.

__Impacted versions:__

* 7.0
* 8.0

__Steps to reproduce:__
Using Firefox, with a clean Odoo install:

* Install the Document module
* Go to the Administrator user page
* Upload an image file attachment
* Download the file attachment

__Current behavior:__

* Firefox will directly download the file

__Expected behavior:__
* Firefox should offer to open the file

__Additional information__

* 'application/octet-stream' is hardcoded in the saveas method of ./addons/web/controllers/main.py
* The content-type header should contain the file_type of the ir.attachment

__Reference__
https://github.com/odoo/odoo/blob/b1f1596aef5e8968d22abb63f9e7bf8da72b009b/addons/web/controllers/main.py