[FIX] document_url: Improve the definition of mimetype=application/link only to records linked to a model to avoid errors with the developer model (with assets).

This commit is contained in:
Víctor Martínez
2022-01-20 14:04:55 +01:00
parent b20fd056b1
commit 22218ade21
4 changed files with 27 additions and 2 deletions

View File

@@ -8,6 +8,6 @@ class IrAttachment(models.Model):
_inherit = "ir.attachment"
def _compute_mimetype(self, values):
if values.get("url"):
if values.get("url") and values.get("res_model") and values.get("res_id"):
return "application/link"
return super()._compute_mimetype(values)