diff --git a/document_url/__manifest__.py b/document_url/__manifest__.py index 6f81feed..0900b1e8 100644 --- a/document_url/__manifest__.py +++ b/document_url/__manifest__.py @@ -2,7 +2,7 @@ # Copyright 2020 Tecnativa - Manuel Calero { "name": "URL attachment", - "version": "15.0.1.0.0", + "version": "16.0.1.0.0", "category": "Tools", "author": "Tecnativa, Odoo Community Association (OCA)", "website": "https://github.com/OCA/knowledge", diff --git a/document_url/migrations/14.0.1.0.0/post-migration.py b/document_url/migrations/14.0.1.0.0/post-migration.py deleted file mode 100644 index 58a70619..00000000 --- a/document_url/migrations/14.0.1.0.0/post-migration.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2021 Tecnativa - Víctor Martínez -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from openupgradelib import openupgrade - - -@openupgrade.migrate() -def migrate(env, version): - openupgrade.logged_query( - env.cr, - """ - UPDATE ir_attachment - SET mimetype = 'application/link' - WHERE type = 'link' - """, - ) diff --git a/document_url/tests/test_document_url.py b/document_url/tests/test_document_url.py index 47c7122a..56511345 100644 --- a/document_url/tests/test_document_url.py +++ b/document_url/tests/test_document_url.py @@ -1,5 +1,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +import base64 + from odoo.tests import common @@ -27,3 +29,11 @@ class TestDocumentUrl(common.TransactionCase): self.assertEqual(attachment_added_count, 1) attachment = self.env["ir.attachment"].search(domain) self.assertEqual(attachment.mimetype, "application/link") + + def test_dont_broke_default_compute_mimetype(self): + blob1 = b"blob1" + blob1_b64 = base64.b64encode(blob1) + attachment = self.env["ir.attachment"].create( + {"name": "a2", "datas": blob1_b64, "mimetype": "image/png"} + ) + self.assertEqual(attachment.mimetype, "image/png")