[FIX] web: download file and editor firefox bug

When we download a file (as can be done with attachments in Odoo),
firefox is opening the link in current window but cancel the action once
it is aware the resource is to be downloaded.

But this get firefox into a corrupt state for some contenteditable
features, for example document.queryCommandState which is needed for the
editor will after downloading a file throw an error consistently instead
of working as expected.

It can be reproduced on firefox (at least from version 32 to 46) with
the following snippet:
 https://jsfiddle.net/s246u3ay/3/

The issue is probably linked to the following reported issue since 2005:
 https://bugzilla.mozilla.org/show_bug.cgi?id=297494

This commit avoid the bug by opening attachments download links in a new
window instead of the current one.

closes #12109
opw-676918
This commit is contained in:
Nicolas Lempereur
2016-05-19 14:49:52 +02:00
parent dfcbcb02ce
commit 3b234a23cb
+2 -2
View File
@@ -1064,7 +1064,7 @@
<t t-raw="file.name || file.filename"/>
</span>
<t t-if="(!file.upload or file.percent_loaded&gt;=100)">
<a class="o_image" t-att-href="file.url" t-attf-title="#{(file.name || file.filename) + (file.date?' \n('+file.date+')':'' )}" t-att-data-mimetype="file.mimetype" t-attf-data-src="/web/image/#{file.id}/100x80">
<a class="o_image" target="_blank" t-att-href="file.url" t-attf-title="#{(file.name || file.filename) + (file.date?' \n('+file.date+')':'' )}" t-att-data-mimetype="file.mimetype" t-attf-data-src="/web/image/#{file.id}/100x80">
<t t-raw="file.name || file.filename"/>
</a>
<span class="fa fa-stack oe_delete" title="Delete this file" t-attf-data-id="#{file.id}">
@@ -1079,7 +1079,7 @@
<t t-foreach="widget.get('value')" t-as="id">
<t t-set="file" t-value="widget.data[id]"/>
<div>
<a t-att-href="file.url" t-attf-title="#{(file.name || file.filename) + (file.date?' \n('+file.date+')':'' )}">
<a target="_blank" t-att-href="file.url" t-attf-title="#{(file.name || file.filename) + (file.date?' \n('+file.date+')':'' )}">
<t t-raw="file.name || file.filename"/>
</a>
</div>