mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-14 01:41:26 -06:00

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
14 lines
362 B
Python
14 lines
362 B
Python
# 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)
|