[IMP] document_url: Visual and functional improvements in UI.

Define the add attachment and add URL buttons on the same line.
Allow downloading of url type attachments by clicking on the icon or the name.
Define the name of the url type attachments as links (allows to open it in a new tab).
Hide the download button for url attachments.
Force to set mimetype to "application/link" for url attachments.
Displays a link icon for url attachments.
TT30263
This commit is contained in:
Víctor Martínez
2021-10-13 17:27:50 +02:00
committed by Franco Leyes
parent 5d633916a5
commit 20f18d2920
9 changed files with 92 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import ir_attachment

View File

@@ -0,0 +1,13 @@
# Copyright 2021 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
class IrAttachment(models.Model):
_inherit = "ir.attachment"
def _compute_mimetype(self, values):
if values.get("url"):
return "application/link"
return super()._compute_mimetype(values)