From bee9e83e151aff28f949cfc2788c06274e9d9094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Fri, 20 Oct 2023 11:00:41 +0200 Subject: [PATCH] [OU-ADD] payment_paypal: Migration to 16.0 TT44209 --- docsource/modules150-160.rst | 2 +- .../16.0.2.0/noupdate_changes.xml | 4 ++-- .../payment_paypal/16.0.2.0/post-migration.py | 16 +++++++++++++++ .../payment_paypal/16.0.2.0/pre-migration.py | 15 ++++++++++++++ .../16.0.2.0/upgrade_analysis_work.txt | 20 +++++++++++++++++++ 5 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 openupgrade_scripts/scripts/payment_paypal/16.0.2.0/post-migration.py create mode 100644 openupgrade_scripts/scripts/payment_paypal/16.0.2.0/pre-migration.py create mode 100644 openupgrade_scripts/scripts/payment_paypal/16.0.2.0/upgrade_analysis_work.txt diff --git a/docsource/modules150-160.rst b/docsource/modules150-160.rst index cec5b51e4c57..6f67af7395f9 100644 --- a/docsource/modules150-160.rst +++ b/docsource/modules150-160.rst @@ -564,7 +564,7 @@ Module coverage 15.0 -> 16.0 +-------------------------------------------------+----------------------+-------------------------------------------------+ | payment_ogone | | | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| payment_paypal | | | +| payment_paypal | Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ | payment_payulatam | | | +-------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/payment_paypal/16.0.2.0/noupdate_changes.xml b/openupgrade_scripts/scripts/payment_paypal/16.0.2.0/noupdate_changes.xml index 5491978c7249..1abb2003cf17 100644 --- a/openupgrade_scripts/scripts/payment_paypal/16.0.2.0/noupdate_changes.xml +++ b/openupgrade_scripts/scripts/payment_paypal/16.0.2.0/noupdate_changes.xml @@ -1,7 +1,7 @@ - paypal - + diff --git a/openupgrade_scripts/scripts/payment_paypal/16.0.2.0/post-migration.py b/openupgrade_scripts/scripts/payment_paypal/16.0.2.0/post-migration.py new file mode 100644 index 000000000000..23239707ab03 --- /dev/null +++ b/openupgrade_scripts/scripts/payment_paypal/16.0.2.0/post-migration.py @@ -0,0 +1,16 @@ +# Copyright 2023 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.delete_records_safely_by_xml_id( + env, + [ + "payment_paypal.payment_method_paypal", + ], + ) + openupgrade.load_data( + env.cr, "payment_paypal", "migrations/16.0.2.0/noupdate_changes.xml" + ) diff --git a/openupgrade_scripts/scripts/payment_paypal/16.0.2.0/pre-migration.py b/openupgrade_scripts/scripts/payment_paypal/16.0.2.0/pre-migration.py new file mode 100644 index 000000000000..66594739933d --- /dev/null +++ b/openupgrade_scripts/scripts/payment_paypal/16.0.2.0/pre-migration.py @@ -0,0 +1,15 @@ +# Copyright 2023 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from openupgradelib import openupgrade + +_xmlids_renames = [ + ( + "payment_paypal.payment_acquirer_form", + "payment_paypal.payment_provider_form", + ), +] + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.rename_xmlids(env.cr, _xmlids_renames) diff --git a/openupgrade_scripts/scripts/payment_paypal/16.0.2.0/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/payment_paypal/16.0.2.0/upgrade_analysis_work.txt new file mode 100644 index 000000000000..3f60cfe420b6 --- /dev/null +++ b/openupgrade_scripts/scripts/payment_paypal/16.0.2.0/upgrade_analysis_work.txt @@ -0,0 +1,20 @@ +---Models in module 'payment_paypal'--- +---Fields in module 'payment_paypal'--- +payment_paypal / payment.acquirer / paypal_email_account (char) : DEL +payment_paypal / payment.acquirer / paypal_pdt_token (char) : DEL +payment_paypal / payment.acquirer / paypal_seller_account (char) : DEL +payment_paypal / payment.acquirer / paypal_use_ipn (boolean) : DEL +payment_paypal / payment.acquirer / provider (False) : DEL selection_keys: ['adyen', 'alipay', 'authorize', 'buckaroo', 'mollie', 'none', 'ogone', 'paypal'], mode: modify +payment_paypal / payment.provider / code (False) : NEW selection_keys: ['adyen', 'alipay', 'aps', 'asiapay', 'authorize', 'buckaroo', 'custom', 'demo', 'flutterwave', 'mercado_pago', 'mollie', 'none', 'ogone', 'paypal'], mode: modify +payment_paypal / payment.provider / paypal_email_account (char) : NEW +payment_paypal / payment.provider / paypal_pdt_token (char) : NEW +payment_paypal / payment.provider / paypal_seller_account (char) : NEW +payment_paypal / payment.provider / paypal_use_ipn (boolean) : NEW hasdefault: default +# NOTHING TO DO: `payment.acquirer` renamed to `payment.provider` in payment module +---XML records in module 'payment_paypal'--- +DEL account.payment.method: payment_paypal.payment_method_paypal (noupdate) +# DONE: post-migration (delete record) + +NEW ir.ui.view: payment_paypal.payment_provider_form +DEL ir.ui.view: payment_paypal.payment_acquirer_form +# DONE: pre-migration (renamed)