PDF.JS printing from Chrome broken (Odoo 13 Docker) - odoo

I'm using Odoo 13 in Docker. When viewing a PDF preview using PDF.JS (such as work instructions on a work order) there is no print button when using a Chrome-based browser, and pressing ctrl+p shows the error message "Warning: Printing is not fully supported by this browser." There is also a "More Information" button, which when pressed displays "PDF.js v? (build: ?)." Printing, both with ctrl+p and with the print button, works as expected in Firefox.
I found the following open Github issue, though it's for Odoo 12: https://github.com/odoo/odoo/issues/27668
I tried upgrading my version of PDF.JS by essentially copying this PR: https://github.com/odoo/odoo/pull/49457 I made sure to restart Odoo, upgrade the web module & regenerate assets bundles, but neither of the versions I tried (2.2.228 & 2.9.359) behaved any differently.
I also tried the following snippet of code from the bottom of that Github issue:
<templates>
<t t-extend="DocumentViewer.Content">
<t t-jquery="iframe.o_viewer_pdf" t-operation="replace">
<iframe class="mb48 o_viewer_pdf" t-if="widget.activeAttachment.type == 'application/pdf'" t-attf-src="/web/content/#{widget.activeAttachment.id}" />
</t>
</t>
</templates>
According to the user who posted it, this code is supposed to override PDF.JS and use the browser's default PDF viewer. I tried putting this code in an XML file in a custom module (tried loading it both as 'data' & 'qweb' from manifest.py), but saw no effects.
If anyone has faced this issue before, or just has any ideas I haven't tried, I would greatly appreciate some help!

Related

jQuery 3.3.1 file upload freeze in Safari 12.1.2 and higher

I'm trying to upload a file using jQuery 3.3.1 in Safari 12.1.2 and it allows me to browse and select the file that needs to be uploaded. But when I try to upload the selected file. It does nothing. No error message is displayed, at least in the browser console. This is working fine in Safari versions below 12.1.2, Chrome and Firefox. Can some one please let me know a clue to at least start troubleshooting this issue. (I also tried to debug the code but it ended up in jQuery-3.3.1.min.js and terminates.)
Found the change required to fix the issue. Option "forceIframeTransport" In the code snippet that refers to the fileupload function in jdeQuery-File-Upload has been set to "true" in my code. (As per the jQuery-File-Upload doc this value is set to false by default) How ever for a unknown reason file upload fails in Safari 12.1.2 and above when this value is set to true. So simple the fix in my case is setting "forceIframeTransport" to "false" as shown in below code snippet. (please note that it's not required to have cross cite file uploads which is affected by this option in my application)
$('.assetupload').fileupload({
**forceIframeTransport : false**,
add : function(e, data) {
.......
.......
});

Cannot Download PDF's Using Selenium/Python 3.x, But It works When I do it Manually

I read through a ton of answers to this query of mine but couldn't find anything specific. Hence asking here
Here's the scenario, On a webpage, when I click a download button, it downloads a PDF file correctly, On the browser, I have set the Firefox preferences to save the file rather than open in preview.
However, when I run my selenium/Python script, the download keeps opening in the preview, there are other PDF downloads on the page and they work fine. Upon inspecting both the download buttons, the only difference I see is the one that does not download has a relative URL in its href value.
I am also using the following firefox options settings in my script, but with no help. Please guide me in the right direction. Thanks in advance!
**************************
fp = webdriver.FirefoxProfile()
fp.set_preference("browser.download.folderList", 2)
fp.set_preference("browser.download.manager.showWhenStarting", False)
fp.set_preference("browser.download.dir", 'Path to Save The file')
fp.set_preference("pdfjs.enabledCache.state", False)
fp.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/pdf")
fp.set_preference("pdfjs.disabled", "true")
# disable Adobe Acrobat PDF preview plugin
fp.set_preference("plugin.scan.plid.all", "false")
fp.set_preference("plugin.scan.Acrobat", "99.0")
self.driver = webdriver.Firefox(firefox_profile=fp,executable_path="path to my geckodriver")
self.driver.get("url")
I had the same problem - setting to disable pdfjs only worked when clicked manually on about:config page. Turned out that what seems to have solved the issue was (Firefox 60.6.1ESR):
profile.setPreference("pdfjs.disabled", true);
profile.setPreference("pdfjs.enabledCache.state", false); // <= THIS

Pycharm, keep getting Flow Tool panel with "Error: Flow executable path is incorrect"

After updating to Pycharm 2017.2.1 I got this Flow Tool panel (although not having flow installed) which pops up and I can not get rid of it.
This appears to be a bug. A workaround is mentioned:
edit .idea/workspace.xml and remove the
<component name="JsFlowSettings">
...
</component>
section
Another workaround which seemed to work for me:
select Flow under [file/settings/languages&frameworks/javascript] as Javascript Language version and untick all flow settings options that then appear.

Why in Opera the 'chrome_url_overrides' is not allowed for specified extension ID?

I am making a cross-browser extension, which overrides the standard "New Tab" page.
There is a manifest.json key for that, called chrome_url_overrides:
"chrome_url_overrides": { "newtab": "index.html" }
It works in Chrome and Firefox! But in Opera (45.0) the following error occurs when I try to load the extension:
'chrome_url_overrides' is not allowed for specified extension ID.
Based on what I've read in the MDN chrome_url_overrides docs, Opera supports that.
Now I'm not sure if Opera doesn't allow that in general, or if there is a way to activate it?
Edit: I found a similar, unanswered yet, 3-months-old thread in the Opera Forums.
Actually Opera now officially does not support chrome_url_overrides. A piece of evidence can be found on the MDN page that you referenced and it was confirmed by an Opera representative in their forum.
A potential workaround for achieving a new tab extension in Opera (actually this should work in other browsers too) is to use a background script with the following code:
const redirectURLS = [
"opera://startpage/",
"browser://startpage/",
"chrome://startpage/"
];
chrome.tabs.onCreated.addListener(function(tab) {
for (let i = 0; i < redirectURLS.length; i++) {
if (tab.url === redirectURLS[i]) break; // user is trying to open startpage
if (i == redirectURLS.length - 1) return; // Tab is not trying to open a startpage
}
chrome.tabs.update(tab.id, { url: "index.html" });
});
Having this will check if the user tries to open a new tab and if this is the case it will open the custom index.html page that came with installing the plugin instead. It's a hacky and dirty and not sure if it's going to be accepted by Opera but still, this may be a path of salvation for someone desperately trying to get a new tab extension live among the other Opera Addons.
Fun fact: Opera developed and distributed an addon which helps you install chrome extension from chrome extension store on Opera but the new tab extensions don't work and fail upon installation with the following message:
[Compatibility notice]
Please, be aware that this extension requires APIs that are not supported in Opera.
It still can work in Opera, so complete installation to verify.
Opera's Acceptance Criteria say that:
Extensions cannot replace Opera’s default start page.
Even if you manage to accomplish your aim and replace the standard "New Tab" page, then the extension will not pass moderation.
Workarounds include assigning a keyboard shortcut to open your page, or launching it from a browser action button.

Getting error in using SoundJS

I'm using Flash HTML5Canvas document to publish html files.
I want to add audio playback and started using SoundJS but having problems in using it.
I used the following code in the file.
createjs.Sound.registerPlugins([createjs.WebAudioPlugin, createjs.HTMLAudioPlugin, createjs.FlashPlugin]);
But when I publish it and and run it in browser(Chrome, Win7 Pro 64) I get the following error in console.
"Cannot read property registerPlugins of undefined"
When I checked the html source code, soundjs source is not mentioned. easeljs, tween & movieclip sources are mentioned.
How do I get this resolved?
Thanks :)
First I needed to edit the html file produced by flash cc.
I manually added the line
"http://code.createjs.com/soundjs-0.6.1.min.js"></script>
Double clicking the edited html file and running in browser gives HTTP errors.
So in the publish settings of Flash CC, I disabled the 'Overwrite HTML' option and then if I test/publish via Flash CC, Soundjs loads fine. It requires a local server to test it and I missed that part.