[FIX] discuss: clicking on attachment download closes current rtc call
Using <a> with 'download' attribute to download the attachment. Prevent calling .navigate() interrupting the current call. task-2692597 closes odoo/odoo#80903 X-original-commit: 97fa88c2e8407972c83c93d4d2198633a5560ecc Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
committed by
Sébastien Theys
parent
eb29425f73
commit
e6b4761bec
@@ -139,8 +139,7 @@ export class AttachmentViewer extends Component {
|
||||
* @private
|
||||
*/
|
||||
_download() {
|
||||
const id = this.attachmentViewer.attachment.id;
|
||||
this.env.services.navigate(`/web/content/ir.attachment/${id}/datas`, { download: true });
|
||||
this.attachmentViewer.attachment.download();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -51,7 +51,12 @@ registerModel({
|
||||
* Send the attachment for the browser to download.
|
||||
*/
|
||||
download() {
|
||||
this.env.services.navigate(`/web/content/ir.attachment/${this.id}/datas`, { download: true });
|
||||
const downloadLink = document.createElement('a');
|
||||
downloadLink.setAttribute('href', `/web/content/ir.attachment/${this.id}/datas?download=true`);
|
||||
// Adding 'download' attribute into a link prevents open a new tab or change the current location of the window.
|
||||
// This avoids interrupting the activity in the page such as rtc call.
|
||||
downloadLink.setAttribute('download', '');
|
||||
downloadLink.click();
|
||||
},
|
||||
/**
|
||||
* Handles click on download icon.
|
||||
|
||||
Reference in New Issue
Block a user