mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[MIG]web_widget_image_download: Migration to 16.0
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
/* Copyright 2016 Flavio Corpa <flavio.corpa@tecnativa.com>
|
||||
* Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
|
||||
* Copyright 2024 Manuel Regidor <manuel.regidor@sygel.es>
|
||||
* License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */
|
||||
|
||||
import {patch} from "@web/core/utils/patch";
|
||||
import {ImageField} from "@web/views/fields/image/image_field";
|
||||
|
||||
patch(ImageField.prototype, "web_widget_image_download", {
|
||||
download() {
|
||||
const downloadLink = document.createElement("a");
|
||||
downloadLink.setAttribute("href", this.getUrl(this.props.name));
|
||||
downloadLink.setAttribute("download", "");
|
||||
downloadLink.click();
|
||||
},
|
||||
onFileDownload() {
|
||||
this.download();
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user