knowledge/document_url/models/ir_attachment.py
Pedro M. Baeza 54f8d34df9 [FIX] document_url: Change mimetype only if type=url
Other modules like web_pwa_oca uses url field for storing an indexed
path for later being searched in the controller, so let's restrict the
mimetype change if both url and type=url is set.
2025-05-08 10:11:08 +05:30

14 lines
401 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") and values.get("type", "url") == "url":
return "application/link"
return super()._compute_mimetype(values)