diff options
| author | Parth Choksi <pch@odoo.com> | 2019-05-14 06:38:29 +0000 |
|---|---|---|
| committer | Simon Lejeune <sle@openerp.com> | 2019-05-22 13:07:21 +0000 |
| commit | 00997c93a9cc3a3fcb3cfd7f63fd747251978a9e (patch) | |
| tree | 9015241d3e889aa7260738f91fb35d62591b8590 | |
| parent | 047bc013e04accde2c41ff0b5695819a3353bd86 (diff) | |
[FIX] web: pdf file not previewed
The pdf_viewer widget fails to load file and hence shows error.
This is due to the wrong controller called(wrong URI passed),
while loading a file using pdfjs.
For files other than images, /web/content controller should
be called since since odoo/odoo#31811.
This is similar to the enterprise fix 793c76298a2b301a2
task-1932190
closes odoo/odoo#33354
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
| -rw-r--r-- | addons/web/static/src/js/fields/basic_fields.js | 2 | ||||
| -rw-r--r-- | addons/web/static/tests/fields/basic_fields_tests.js | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index f4a518e28ea..2e17dee139f 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -1729,7 +1729,7 @@ var FieldPdfViewer = FieldBinaryFile.extend({ id: this.res_id, }; var queryString = $.param(queryObj); - fileURI = '/web/image?' + queryString + fileURI = '/web/content?' + queryString; } fileURI = encodeURIComponent(fileURI); var viewerURL = '/web/static/lib/pdfjs/web/viewer.html?file='; diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index 02bf293e001..1a1b3c75bb0 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -1928,7 +1928,7 @@ QUnit.module('basic_fields', { assert.isVisible(form.$('.o_field_widget iframe.o_pdfview_iframe'), "there should be an visible iframe"); assert.hasAttrValue(form.$('.o_field_widget iframe.o_pdfview_iframe'), 'data-src', - '/web/static/lib/pdfjs/web/viewer.html?file=%2Fweb%2Fimage%3Fmodel%3Dpartner%26field%3Ddocument%26id%3D1#page=1', + '/web/static/lib/pdfjs/web/viewer.html?file=%2Fweb%2Fcontent%3Fmodel%3Dpartner%26field%3Ddocument%26id%3D1#page=1', "the src attribute should be correctly set on the iframe"); form.destroy(); |
