From a624f08f5ffbef69bf5f631fb11d7a04522afd24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesu=CC=81s=20Alan=20Ramos=20Rodri=CC=81guez?= Date: Tue, 26 Apr 2022 14:04:46 -0500 Subject: [PATCH] [MIG] base_comment_template: Migration to 15.0 --- base_comment_template/README.rst | 14 +++++---- base_comment_template/__manifest__.py | 2 +- .../migrations/14.0.2.0.0/post-migration.py | 29 ------------------ .../migrations/14.0.2.0.0/pre-migration.py | 30 ------------------- .../models/base_comment_template.py | 1 - base_comment_template/readme/CONTRIBUTORS.rst | 4 +++ .../static/description/index.html | 12 +++++--- .../tests/test_base_comment_template.py | 10 ++++--- .../views/base_comment_template_view.xml | 2 +- 9 files changed, 29 insertions(+), 75 deletions(-) delete mode 100644 base_comment_template/migrations/14.0.2.0.0/post-migration.py delete mode 100644 base_comment_template/migrations/14.0.2.0.0/pre-migration.py diff --git a/base_comment_template/README.rst b/base_comment_template/README.rst index dfc2eedc1..e2016370d 100644 --- a/base_comment_template/README.rst +++ b/base_comment_template/README.rst @@ -14,13 +14,13 @@ Base Comments Templates :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github - :target: https://github.com/OCA/reporting-engine/tree/14.0/base_comment_template + :target: https://github.com/OCA/reporting-engine/tree/15.0/base_comment_template :alt: OCA/reporting-engine .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/reporting-engine-14-0/reporting-engine-14-0-base_comment_template + :target: https://translation.odoo-community.org/projects/reporting-engine-15-0/reporting-engine-15-0-base_comment_template :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/143/14.0 + :target: https://runbot.odoo-community.org/runbot/143/15.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -120,7 +120,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -158,6 +158,10 @@ Contributors * Carlos Roca * Víctor Martínez +* `Jarsa `_: + + * Alan Ramos + Maintainers ~~~~~~~~~~~ @@ -171,6 +175,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/reporting-engine `_ project on GitHub. +This module is part of the `OCA/reporting-engine `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_comment_template/__manifest__.py b/base_comment_template/__manifest__.py index e7c4f8e23..913a95af7 100644 --- a/base_comment_template/__manifest__.py +++ b/base_comment_template/__manifest__.py @@ -5,7 +5,7 @@ "name": "Base Comments Templates", "summary": "Add conditional mako template to any report" "on models that inherits comment.template.", - "version": "14.0.3.0.1", + "version": "15.0.1.0.0", "category": "Reporting", "website": "https://github.com/OCA/reporting-engine", "author": "Camptocamp, Odoo Community Association (OCA)", diff --git a/base_comment_template/migrations/14.0.2.0.0/post-migration.py b/base_comment_template/migrations/14.0.2.0.0/post-migration.py deleted file mode 100644 index 30414fe2c..000000000 --- a/base_comment_template/migrations/14.0.2.0.0/post-migration.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2021 Tecnativa - Víctor Martínez -# Copyright 2021 Tecnativa - Pedro M. Baeza -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from openupgradelib import openupgrade - -from odoo.tools import parse_version - - -@openupgrade.migrate() -def migrate(env, version): - if parse_version(version) == parse_version("14.0.1.0.0"): - openupgrade.logged_query( - env.cr, - """ - INSERT INTO base_comment_template_res_partner_rel - (res_partner_id, base_comment_template_id) - SELECT SPLIT_PART(ip.res_id, ',', 2)::int AS res_partner_id, - SPLIT_PART(ip.value_reference, ',', 2)::int AS base_comment_template_id - FROM ir_property ip - JOIN ir_model_fields imf ON ip.fields_id = imf.id - JOIN res_partner rp ON rp.id = SPLIT_PART(ip.res_id, ',', 2)::int - JOIN base_comment_template bct - ON bct.id = SPLIT_PART(ip.value_reference, ',', 2)::int - WHERE imf.name = 'property_comment_template_id' - AND imf.model = 'res.partner' - AND ip.res_id IS NOT NULL - ON CONFLICT DO NOTHING - """, - ) diff --git a/base_comment_template/migrations/14.0.2.0.0/pre-migration.py b/base_comment_template/migrations/14.0.2.0.0/pre-migration.py deleted file mode 100644 index 75933bfdf..000000000 --- a/base_comment_template/migrations/14.0.2.0.0/pre-migration.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2021 Tecnativa - Víctor Martínez -# Copyright 2021 Tecnativa - Pedro M: Baeza -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from openupgradelib import openupgrade - -from odoo.tools import parse_version - -field_renames = [ - ("base.comment.template", "base_comment_template", "priority", "sequence"), -] - - -@openupgrade.migrate() -def migrate(env, version): - if parse_version(version) == parse_version("14.0.1.0.0"): - openupgrade.rename_fields(env, field_renames) - if openupgrade.table_exists(env.cr, "base_comment_template_res_partner_rel"): - # Swap column names, as they were incorrect - env.cr.execute( - "ALTER TABLE base_comment_template_res_partner_rel " - "RENAME base_comment_template_id TO temp" - ) - env.cr.execute( - "ALTER TABLE base_comment_template_res_partner_rel " - "RENAME res_partner_id TO base_comment_template_id" - ) - env.cr.execute( - "ALTER TABLE base_comment_template_res_partner_rel " - "RENAME temp TO res_partner_id" - ) diff --git a/base_comment_template/models/base_comment_template.py b/base_comment_template/models/base_comment_template.py index 6ae2e2644..66764ccc1 100644 --- a/base_comment_template/models/base_comment_template.py +++ b/base_comment_template/models/base_comment_template.py @@ -22,7 +22,6 @@ class BaseCommentTemplate(models.Model): help="This field allows to select the position of the comment on reports.", ) name = fields.Char( - string="Name", translate=True, required=True, help="Name/description of this comment template", diff --git a/base_comment_template/readme/CONTRIBUTORS.rst b/base_comment_template/readme/CONTRIBUTORS.rst index 0468fc782..27a71627d 100644 --- a/base_comment_template/readme/CONTRIBUTORS.rst +++ b/base_comment_template/readme/CONTRIBUTORS.rst @@ -20,3 +20,7 @@ * Carlos Roca * Víctor Martínez + +* `Jarsa `_: + + * Alan Ramos diff --git a/base_comment_template/static/description/index.html b/base_comment_template/static/description/index.html index cd4bfc9b4..cf5471d59 100644 --- a/base_comment_template/static/description/index.html +++ b/base_comment_template/static/description/index.html @@ -3,7 +3,7 @@ - + Base Comments Templates