mirror of
https://github.com/OCA/knowledge.git
synced 2025-12-19 03:42:19 -06:00
[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:
committed by
Bhavesh Heliconia
parent
b029c7ac0a
commit
620aac5041
13
document_url/models/ir_attachment.py
Normal file
13
document_url/models/ir_attachment.py
Normal 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)
|
||||
Reference in New Issue
Block a user