mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-13 07:24:48 -06:00
[16.0][MIG] document_url: Migration to 16.0
This commit is contained in:
parent
ab451059aa
commit
3d342dbdea
@ -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",
|
||||
|
@ -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'
|
||||
""",
|
||||
)
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user