From 1ddca69a2ded2251763432ce971760e47fb47f16 Mon Sep 17 00:00:00 2001 From: Joel Zilli Date: Fri, 8 Apr 2022 15:34:23 -0300 Subject: [PATCH] [MIG] document_url: Migration to 15.0 --- document_url/__manifest__.py | 14 +++++----- .../migrations/14.0.1.0.0/post-migration.py | 16 ------------ .../migrations/14.0.1.1.0/post-migration.py | 24 ----------------- document_url/tests/test_document_url.py | 14 +++++----- document_url/view/document_url_view.xml | 26 +++++-------------- document_url/wizard/document_url.py | 2 +- 6 files changed, 21 insertions(+), 75 deletions(-) delete mode 100644 document_url/migrations/14.0.1.0.0/post-migration.py delete mode 100644 document_url/migrations/14.0.1.1.0/post-migration.py diff --git a/document_url/__manifest__.py b/document_url/__manifest__.py index be72c409..7bff3083 100644 --- a/document_url/__manifest__.py +++ b/document_url/__manifest__.py @@ -2,16 +2,18 @@ # Copyright 2020 Tecnativa - Manuel Calero { "name": "URL attachment", - "version": "14.0.1.1.0", + "version": "15.0.1.0.0", "category": "Tools", "author": "Tecnativa, Odoo Community Association (OCA)", "website": "https://github.com/OCA/knowledge", "license": "AGPL-3", "depends": ["mail"], - "data": [ - "view/document_url_view.xml", - "security/ir.model.access.csv", - ], - "qweb": ["static/src/xml/url.xml"], + "data": ["view/document_url_view.xml", "security/ir.model.access.csv"], + "assets": { + "web.assets_backend": [ + "document_url/static/src/js/url.js", + ], + "web.assets_qweb": ["document_url/static/src/xml/url.xml"], + }, "installable": True, } 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/migrations/14.0.1.1.0/post-migration.py b/document_url/migrations/14.0.1.1.0/post-migration.py deleted file mode 100644 index 3f2df440..00000000 --- a/document_url/migrations/14.0.1.1.0/post-migration.py +++ /dev/null @@ -1,24 +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 = 'text/css' - WHERE mimetype = 'application/link' AND res_id = 0 AND name LIKE '%.%css' - """, - ) - openupgrade.logged_query( - env.cr, - """ - UPDATE ir_attachment - SET mimetype = 'application/javascript' - WHERE mimetype = 'application/link' AND res_id = 0 AND name LIKE '%.js' - """, - ) diff --git a/document_url/tests/test_document_url.py b/document_url/tests/test_document_url.py index 45ee2ed0..47c7122a 100644 --- a/document_url/tests/test_document_url.py +++ b/document_url/tests/test_document_url.py @@ -7,14 +7,12 @@ class TestDocumentUrl(common.TransactionCase): def setUp(self): super().setUp() wizard_add_url = self.env["ir.attachment.add_url"] - ctx = { - "active_model": "res.users", - "active_id": self.env.ref("base.user_demo").id, - "active_ids": [self.env.ref("base.user_demo").id], - } - self.wizard_add_url = wizard_add_url.with_context(ctx).create( - {"name": "Demo User (Website)", "url": "http://www.odoodemouser.com"} - ) + + self.wizard_add_url = wizard_add_url.with_context( + active_model="res.users", + active_id=self.env.ref("base.user_demo").id, + active_ids=[self.env.ref("base.user_demo").id], + ).create({"name": "Demo User (Website)", "url": "http://www.odoodemouser.com"}) def test_add_url_attachment(self): self.wizard_add_url.action_add_url() diff --git a/document_url/view/document_url_view.xml b/document_url/view/document_url_view.xml index 8796420d..3a69f6ef 100644 --- a/document_url/view/document_url_view.xml +++ b/document_url/view/document_url_view.xml @@ -1,25 +1,11 @@ -