odoo/odoo#187970

Created by Discuss, Zelong Lin (zel)
Merged at 914db0e45bdbf2c9fa8232055b404bd0a854c633

Statuses:

label
odoo-dev:17.0-url-attachment-fix-zel
head
607d280f2360019badbab07c8ea7d5da26b9d1bd
merged
10 months ago by Discuss, Sébastien Theys (seb)
odoo/odoo
17.0 #187970
saas-17.2 #189080
saas-17.4 #189335
18.0 #190142
saas-18.2
saas-18.3
saas-18.4
19.0
master #190223

[FIX] web,*: file viewer to show url attachment

The file viewer tries to show the document from the url obtained from the defaultSource function in file_model.js. This function builds the url using urlRoute.

Before the fix, the urlRoute is the url from the attachment. This causes the PDF viewer to fail because it has a same-origin policy.

This fix avoids to use the url to the one from the attachment's url directly so that the viewer can show the document correctly with the computed urlRoute.

The attachment url does not need to be used at all, as the odoo server will properly direct.