From 2d5dd1448fcb86b5977ac10bf672698a065d18b9 Mon Sep 17 00:00:00 2001 From: Dhruv Patel Date: Thu, 12 Mar 2020 07:25:30 +0000 Subject: [PATCH] [FIX] web: restrict to open sidebar forcefully in pdf viewer initially Before this commit, when PDF viewer opens, it opens the sidebar forcefully. Now with this commit, we have restricted to open the sidebar on initial load by passing the false value to the forceOpen flag, we did this changes directly in the library file itself as the file loads in iframe so we can not change the file from outside by overriding the existing function or parameter. task-2209742 closes odoo/odoo#47458 Signed-off-by: Aaron Bohy (aab) --- addons/web/static/lib/pdfjs/web/viewer.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/web/static/lib/pdfjs/web/viewer.js b/addons/web/static/lib/pdfjs/web/viewer.js index 5a5ecf79b99..54f95117ab9 100644 --- a/addons/web/static/lib/pdfjs/web/viewer.js +++ b/addons/web/static/lib/pdfjs/web/viewer.js @@ -5077,7 +5077,10 @@ function () { return; } - if (!this._switchView(view, true)) { + // Odoo: This change is needed here as we can't change this parameter in an iframe. + // pass forceOpen argument to false to restrict opening of sidebar forcefully when + // pdf viewer opens initially. + if (!this._switchView(view, false)) { this._dispatchEvent(); } }