From 4fb700ef994e12352f56c35442c5d92088ece3f5 Mon Sep 17 00:00:00 2001 From: Mountain Tran Date: Fri, 3 Jun 2022 20:59:59 +0700 Subject: [PATCH] [MIG] payment*: migration script (#253) Co-authored-by: Roy Le --- docsource/modules140-150.rst | 28 +-- .../15.0.1.0/post-migration.py | 21 +++ .../payment/15.0.2.0/post-migration.py | 58 ++++++ .../scripts/payment/15.0.2.0/pre-migration.py | 54 ++++++ .../15.0.2.0/upgrade_analysis_work.txt | 166 ++++++++++++++++++ .../payment_adyen/15.0.2.0/post-migration.py | 23 +++ .../15.0.2.0/noupdate_changes.xml | 1 - .../payment_alipay/15.0.2.0/post-migration.py | 23 +++ .../15.0.2.0/upgrade_analysis.txt | 3 + .../15.0.2.0/post-migration.py | 23 +++ .../15.0.2.0/noupdate_changes.xml | 1 - .../15.0.2.0/post-migration.py | 23 +++ .../payment_mollie/15.0.1.0/post-migration.py | 22 +++ .../15.0.1.0/upgrade_analysis.txt | 3 + .../15.0.2.0/noupdate_changes.xml | 1 - .../payment_ogone/15.0.2.0/post-migration.py | 23 +++ .../15.0.2.0/upgrade_analysis.txt | 3 + .../15.0.2.0/noupdate_changes.xml | 1 - .../payment_paypal/15.0.2.0/post-migration.py | 17 ++ .../15.0.2.0/post-migration.py | 23 +++ .../15.0.2.0/upgrade_analysis.txt | 3 + .../15.0.2.0/post-migration.py | 23 +++ .../15.0.2.0/upgrade_analysis.txt | 3 + .../payment_sips/15.0.2.0/post-migration.py | 23 +++ .../15.0.2.0/upgrade_analysis.txt | 3 + .../payment_stripe/15.0.2.0/post-migration.py | 23 +++ .../15.0.2.0/upgrade_analysis.txt | 3 + .../15.0.2.0/noupdate_changes.xml | 1 - .../15.0.2.0/upgrade_analysis_work.txt | 1 + 29 files changed, 581 insertions(+), 19 deletions(-) create mode 100644 openupgrade_scripts/scripts/account_check_printing/15.0.1.0/post-migration.py create mode 100644 openupgrade_scripts/scripts/payment/15.0.2.0/post-migration.py create mode 100644 openupgrade_scripts/scripts/payment/15.0.2.0/pre-migration.py create mode 100644 openupgrade_scripts/scripts/payment/15.0.2.0/upgrade_analysis_work.txt create mode 100644 openupgrade_scripts/scripts/payment_adyen/15.0.2.0/post-migration.py create mode 100644 openupgrade_scripts/scripts/payment_alipay/15.0.2.0/post-migration.py create mode 100644 openupgrade_scripts/scripts/payment_authorize/15.0.2.0/post-migration.py create mode 100644 openupgrade_scripts/scripts/payment_buckaroo/15.0.2.0/post-migration.py create mode 100644 openupgrade_scripts/scripts/payment_mollie/15.0.1.0/post-migration.py create mode 100644 openupgrade_scripts/scripts/payment_ogone/15.0.2.0/post-migration.py create mode 100644 openupgrade_scripts/scripts/payment_payulatam/15.0.2.0/post-migration.py create mode 100644 openupgrade_scripts/scripts/payment_payumoney/15.0.2.0/post-migration.py create mode 100644 openupgrade_scripts/scripts/payment_sips/15.0.2.0/post-migration.py create mode 100644 openupgrade_scripts/scripts/payment_stripe/15.0.2.0/post-migration.py diff --git a/docsource/modules140-150.rst b/docsource/modules140-150.rst index 9996d0e14898..cee24b8ee1b0 100644 --- a/docsource/modules140-150.rst +++ b/docsource/modules140-150.rst @@ -8,7 +8,7 @@ Module coverage 14.0 -> 15.0 +================================================+=====================+=================================================+ |account |Done | | +------------------------------------------------+---------------------+-------------------------------------------------+ -|account_check_printing |Nothing to do |No DB layout changes. | +|account_check_printing |Done |Create account payment method lines | +------------------------------------------------+---------------------+-------------------------------------------------+ |account_debit_note |Nothing to do |No DB layout changes. | +------------------------------------------------+---------------------+-------------------------------------------------+ @@ -494,37 +494,37 @@ Module coverage 14.0 -> 15.0 +------------------------------------------------+---------------------+-------------------------------------------------+ |partner_autocomplete |Nothing to do |No DB layout changes | +------------------------------------------------+---------------------+-------------------------------------------------+ -|payment | | | +|payment |Done | | +------------------------------------------------+---------------------+-------------------------------------------------+ -|payment_adyen | | | +|payment_adyen |Partial | | +------------------------------------------------+---------------------+-------------------------------------------------+ -|payment_alipay | | | +|payment_alipay |Done | | +------------------------------------------------+---------------------+-------------------------------------------------+ -|payment_authorize | | | +|payment_authorize |Partial | | +------------------------------------------------+---------------------+-------------------------------------------------+ -|payment_buckaroo | | | +|payment_buckaroo |Partial | | +------------------------------------------------+---------------------+-------------------------------------------------+ | |del| payment_fix_register_token |Nothing to do |Merged into payment. | +------------------------------------------------+---------------------+-------------------------------------------------+ -| |del| payment_ingenico | |Renamed to payment_ogone. | +| |del| payment_ingenico |Nothing to do |Renamed to payment_ogone. | +------------------------------------------------+---------------------+-------------------------------------------------+ -| |new| payment_mollie | | | +| |new| payment_mollie |Done | | +------------------------------------------------+---------------------+-------------------------------------------------+ | |del| payment_odoo_by_adyen | | | +------------------------------------------------+---------------------+-------------------------------------------------+ -| |new| payment_ogone | |Renamed from payment_ingenico. | +| |new| payment_ogone |Done |Renamed from payment_ingenico. | +------------------------------------------------+---------------------+-------------------------------------------------+ |payment_paypal |Done | | +------------------------------------------------+---------------------+-------------------------------------------------+ -|payment_payulatam | | | +|payment_payulatam |Done | | +------------------------------------------------+---------------------+-------------------------------------------------+ -|payment_payumoney | | | +|payment_payumoney |Done | | +------------------------------------------------+---------------------+-------------------------------------------------+ -|payment_sips | | | +|payment_sips |Done | | +------------------------------------------------+---------------------+-------------------------------------------------+ -|payment_stripe | | | +|payment_stripe |Done | | +------------------------------------------------+---------------------+-------------------------------------------------+ -|payment_transfer | | | +|payment_transfer |Done | | +------------------------------------------------+---------------------+-------------------------------------------------+ |phone_validation |Nothing to do |No DB layout changes. | +------------------------------------------------+---------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/account_check_printing/15.0.1.0/post-migration.py b/openupgrade_scripts/scripts/account_check_printing/15.0.1.0/post-migration.py new file mode 100644 index 000000000000..5abe386fede0 --- /dev/null +++ b/openupgrade_scripts/scripts/account_check_printing/15.0.1.0/post-migration.py @@ -0,0 +1,21 @@ +from openupgradelib import openupgrade + + +def _create_account_payment_method_line(env): + # Create account payment method lines from account payment methods + openupgrade.logged_query( + env.cr, + """ + INSERT INTO account_payment_method_line + (name, payment_method_id, journal_id) + SELECT apm.name, apm.id, aj.id + FROM account_payment_method apm + JOIN account_journal aj ON aj.type = 'bank' + WHERE apm.code = 'check_printing' + """, + ) + + +@openupgrade.migrate() +def migrate(env, version): + _create_account_payment_method_line(env) diff --git a/openupgrade_scripts/scripts/payment/15.0.2.0/post-migration.py b/openupgrade_scripts/scripts/payment/15.0.2.0/post-migration.py new file mode 100644 index 000000000000..04202b3de5c0 --- /dev/null +++ b/openupgrade_scripts/scripts/payment/15.0.2.0/post-migration.py @@ -0,0 +1,58 @@ +from openupgradelib import openupgrade + + +def convert_payment_acquirer_provider(env): + openupgrade.logged_query( + env.cr, + """ + UPDATE payment_acquirer + SET provider = 'none' + WHERE provider = 'manual'""", + ) + + +def fill_payment_transaction_last_state_change(env): + openupgrade.logged_query( + env.cr, + """ + UPDATE payment_transaction + SET last_state_change = write_date + WHERE last_state_change IS NULL + """, + ) + + +def fill_payment_transaction_partner_state_id(env): + openupgrade.logged_query( + env.cr, + """ + UPDATE payment_transaction pt + SET partner_state_id = rp.state_id + FROM res_partner rp + WHERE rp.id = pt.partner_id + AND rp.state_id IS NOT NULL + AND partner_state_id IS NULL + """, + ) + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.load_data(env.cr, "payment", "15.0.2.0/noupdate_changes.xml") + openupgrade.delete_record_translations( + env.cr, + "payment", + [ + "payment_acquirer_adyen", + "payment_acquirer_alipay", + "payment_acquirer_payulatam", + "payment_acquirer_sepa_direct_debit", + "payment_acquirer_stripe", + "payment_token_user_rule", + "payment_transaction_billing_rule", + "payment_transaction_user_rule", + ], + ) + convert_payment_acquirer_provider(env) + fill_payment_transaction_partner_state_id(env) + fill_payment_transaction_last_state_change(env) diff --git a/openupgrade_scripts/scripts/payment/15.0.2.0/pre-migration.py b/openupgrade_scripts/scripts/payment/15.0.2.0/pre-migration.py new file mode 100644 index 000000000000..3ae9acc344b9 --- /dev/null +++ b/openupgrade_scripts/scripts/payment/15.0.2.0/pre-migration.py @@ -0,0 +1,54 @@ +from openupgradelib import openupgrade + + +def fast_fill_payment_token_name(env): + openupgrade.logged_query( + env.cr, + """ + UPDATE payment_token + SET name = 'XXXXXXXXXX????' + WHERE name IS NULL""", + ) + + +def fast_fill_payment_transaction_partner_id(env): + openupgrade.logged_query( + env.cr, + """ + UPDATE payment_transaction pt + SET partner_id = ap.partner_id + FROM account_payment ap + WHERE ap.partner_id IS NOT NULL + AND pt.partner_id IS NULL + AND ap.payment_transaction_id = pt.id + """, + ) + + +@openupgrade.migrate() +def migrate(env, version): + fast_fill_payment_token_name(env) + openupgrade.rename_fields( + env, + [ + ( + "payment.token", + "payment_token", + "payment_ids", + "transaction_ids", + ), + ( + "payment.transaction", + "payment_transaction", + "is_processed", + "is_post_processed", + ), + ( + "payment.transaction", + "payment_transaction", + "payment_token_id", + "token_id", + ), + ], + ) + fast_fill_payment_transaction_partner_id(env) diff --git a/openupgrade_scripts/scripts/payment/15.0.2.0/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/payment/15.0.2.0/upgrade_analysis_work.txt new file mode 100644 index 000000000000..8a10b94485b0 --- /dev/null +++ b/openupgrade_scripts/scripts/payment/15.0.2.0/upgrade_analysis_work.txt @@ -0,0 +1,166 @@ +---Models in module 'payment'--- +new model payment.refund.wizard [transient] +# NOTHING TO DO: new model + +---Fields in module 'payment'--- +payment / account.payment / source_payment_id (many2one) : NEW relation: account.payment, isrelated: related, stored +# DONE: pre-migration: create source_payment_id column + +payment / account.payment.method.line / payment_acquirer_id (many2one): NEW relation: payment.acquirer, isfunction: function, stored +# NOTHING TO DO + +payment / payment.acquirer / _order : _order is now 'module_state, state desc, sequence, name' ('module_state, state, sequence, name') +payment / payment.acquirer / allow_tokenization (boolean) : NEW +payment / payment.acquirer / check_validity (boolean) : DEL +payment / payment.acquirer / inline_form_view_id (many2one): NEW relation: ir.ui.view +payment / payment.acquirer / journal_id (many2one) : not stored anymore +payment / payment.acquirer / journal_id (many2one) : now a function +payment / payment.acquirer / payment_flow (selection) : DEL required, selection_keys: ['form', 's2s'], req_default: function +# NOTHING TO DO + +payment / payment.acquirer / provider (selection) : selection_keys is now '['none']' ('['manual']') +# DONE: post-migration: convert value of provider (manual -> none) + +payment / payment.acquirer / qr_code (boolean) : module is now 'payment_transfer' ('payment') +payment / payment.acquirer / redirect_form_view_id (many2one): NEW relation: ir.ui.view +payment / payment.acquirer / registration_view_template_id (many2one): DEL relation: ir.ui.view +payment / payment.acquirer / save_token (selection) : DEL selection_keys: ['always', 'ask', 'none'] +payment / payment.acquirer / support_authorization (boolean): NEW +payment / payment.acquirer / support_fees_computation (boolean): NEW +payment / payment.acquirer / support_refund (selection) : NEW selection_keys: ['full_only', 'partial'] +payment / payment.acquirer / support_tokenization (boolean): NEW +payment / payment.acquirer / view_template_id (many2one) : DEL relation: ir.ui.view +# NOTHING TO DO + +payment / payment.icon / _order : _order is now 'sequence, name' ('id') +payment / payment.icon / image_payment_form (binary) : now related +payment / payment.icon / sequence (integer) : NEW hasdefault +# NOTHING TO DO + +payment / payment.token / name (char) : now required +# DONE: pre-migration: fill value for name + +payment / payment.token / payment_ids (one2many) : DEL relation: payment.transaction +payment / payment.token / provider (selection) : previously in module payment_authorize +payment / payment.token / transaction_ids (one2many) : NEW relation: payment.transaction +# DONE: pre-migration: rename column payment_ids -> transaction_ids + +payment / payment.transaction / callback_is_done (boolean) : NEW +payment / payment.transaction / company_id (many2one) : NEW relation: res.company, isrelated: related, stored +payment / payment.transaction / date (datetime) : DEL +payment / payment.transaction / html_3ds (char) : DEL +# NOTHING TO DO + +payment / payment.transaction / is_post_processed (boolean) : NEW +payment / payment.transaction / is_processed (boolean) : DEL +# DONE: pre-migration: rename column is_processed -> is_post_processed + +payment / payment.transaction / landing_route (char) : NEW +# NOTHING TO DO + +payment / payment.transaction / last_state_change (datetime) : NEW hasdefault +# DONE: post-migration: fill value for last_state_change + +payment / payment.transaction / operation (selection) : NEW selection_keys: ['offline', 'online_direct', 'online_redirect', 'online_token', 'refund', 'validation'] +# NOTHING TO DO + +payment / payment.transaction / partner_id (many2one) : now required +# DONE: pre-migration: fill value for partner_id + +payment / payment.transaction / partner_state_id (many2one) : NEW relation: res.country.state +# DONE: post-migration: fill value for partner_state_id + +payment / payment.transaction / payment_token_id (many2one) : DEL relation: payment.token +payment / payment.transaction / return_url (char) : DEL +payment / payment.transaction / source_transaction_id (many2one): NEW relation: payment.transaction +payment / payment.transaction / token_id (many2one) : NEW relation: payment.token +# DONE: pre-migration: rename column payment_token_id -> token_id + +payment / payment.transaction / tokenize (boolean) : NEW +payment / payment.transaction / type (selection) : DEL required, selection_keys: ['form', 'form_save', 'server2server', 'validation'], req_default: function +# NOTHING TO DO + +---XML records in module 'payment'--- +DEL account.payment.method: payment.account_payment_method_electronic_in +NEW ir.actions.act_window: payment.action_payment_token +NEW ir.actions.act_window: payment.action_payment_transaction_linked_to_token +DEL ir.actions.act_window: payment.action_payment_tx_ids +DEL ir.actions.act_window: payment.payment_token_action +NEW ir.model.access: payment.payment_acquirer_onboarding_wizard +NEW ir.model.access: payment.payment_link_wizard +NEW ir.model.access: payment.payment_refund_wizard +NEW ir.model.access: payment.payment_token_all +NEW ir.model.access: payment.payment_token_portal +NEW ir.model.access: payment.payment_token_system +NEW ir.model.access: payment.payment_token_user +DEL ir.model.access: payment.access_payment_acquirer_onboarding_wizard +DEL ir.model.access: payment.access_payment_link_wizard +DEL ir.model.access: payment.payment_acquirer_all +DEL ir.model.access: payment.payment_icon_user +DEL ir.model.access: payment.payment_method_all +DEL ir.model.access: payment.payment_method_portal +DEL ir.model.access: payment.payment_method_system +DEL ir.model.access: payment.payment_method_user +DEL ir.model.constraint: payment.constraint_payment_transaction_reference_uniq +NEW ir.rule: payment.payment_acquirer_company_rule +NEW ir.rule: payment.payment_token_billing_rule +NEW ir.rule: payment.payment_token_company_rule +NEW ir.rule: payment.transaction_company_rule +DEL ir.rule: payment.payment_token_salesman_rule +NEW ir.ui.view: payment.checkout +NEW ir.ui.view: payment.footer +NEW ir.ui.view: payment.icon_list +NEW ir.ui.view: payment.manage +NEW ir.ui.view: payment.payment_acquirer_form +NEW ir.ui.view: payment.payment_acquirer_kanban +NEW ir.ui.view: payment.payment_acquirer_list +NEW ir.ui.view: payment.payment_acquirer_search +NEW ir.ui.view: payment.payment_icon_form +NEW ir.ui.view: payment.payment_icon_tree +NEW ir.ui.view: payment.payment_methods +NEW ir.ui.view: payment.payment_refund_wizard_view_form +NEW ir.ui.view: payment.payment_status +NEW ir.ui.view: payment.payment_token_form +NEW ir.ui.view: payment.payment_token_list +NEW ir.ui.view: payment.payment_token_search +NEW ir.ui.view: payment.payment_transaction_form +NEW ir.ui.view: payment.payment_transaction_kanban +NEW ir.ui.view: payment.payment_transaction_list +NEW ir.ui.view: payment.payment_transaction_search +NEW ir.ui.view: payment.portal_breadcrumb +NEW ir.ui.view: payment.transaction_status +NEW ir.ui.view: payment.verified_token_checkmark +NEW ir.ui.view: payment.view_account_journal_form +NEW ir.ui.view: payment.view_account_payment_register_form_inherit_payment +DEL ir.ui.view: payment.acquirer_form +DEL ir.ui.view: payment.acquirer_kanban +DEL ir.ui.view: payment.acquirer_list +DEL ir.ui.view: payment.acquirer_search +DEL ir.ui.view: payment.assets_backend +DEL ir.ui.view: payment.assets_frontend +DEL ir.ui.view: payment.default_acquirer_button +DEL ir.ui.view: payment.pay_methods +DEL ir.ui.view: payment.payment_confirmation_status +DEL ir.ui.view: payment.payment_icon_form_view +DEL ir.ui.view: payment.payment_process_page +DEL ir.ui.view: payment.payment_token_form_view +DEL ir.ui.view: payment.payment_token_tree_view +DEL ir.ui.view: payment.payment_token_view_search +DEL ir.ui.view: payment.payment_tokens_list +DEL ir.ui.view: payment.transaction +DEL ir.ui.view: payment.transaction_form +DEL ir.ui.view: payment.transaction_list +DEL ir.ui.view: payment.transaction_view_kanban +DEL ir.ui.view: payment_fix_register_token.view_account_payment_register_form_inherit_payment +NEW payment.acquirer: payment.payment_acquirer_mollie +NEW payment.acquirer: payment.payment_acquirer_ogone +NEW payment.acquirer: payment.payment_acquirer_payumoney +NEW payment.acquirer: payment.payment_acquirer_test +DEL payment.acquirer: payment.payment_acquirer_ingenico +DEL payment.acquirer: payment.payment_acquirer_odoo_by_adyen +DEL payment.acquirer: payment.payment_acquirer_payu +NEW payment.icon: payment.payment_icon_apple_pay +NEW payment.icon: payment.payment_icon_kbc +NEW payment.icon: payment.payment_icon_paypal +NEW payment.icon: payment.payment_icon_sepa +# NOTHING TO DO diff --git a/openupgrade_scripts/scripts/payment_adyen/15.0.2.0/post-migration.py b/openupgrade_scripts/scripts/payment_adyen/15.0.2.0/post-migration.py new file mode 100644 index 000000000000..8b1a5b148f19 --- /dev/null +++ b/openupgrade_scripts/scripts/payment_adyen/15.0.2.0/post-migration.py @@ -0,0 +1,23 @@ +from openupgradelib import openupgrade + + +def _create_account_payment_method_line(env): + # Create account payment method lines from account payment methods + openupgrade.logged_query( + env.cr, + """ + INSERT INTO account_payment_method_line + (name, payment_method_id, journal_id) + SELECT apm.name, apm.id, aj.id + FROM account_payment_method apm + JOIN payment_acquirer pa ON pa.provider = 'adyen' + JOIN account_journal aj ON aj.type = 'bank' AND aj.id = pa.journal_id + WHERE apm.code = 'adyen' + """, + ) + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.load_data(env.cr, "payment_adyen", "15.0.2.0/noupdate_changes.xml") + _create_account_payment_method_line(env) diff --git a/openupgrade_scripts/scripts/payment_alipay/15.0.2.0/noupdate_changes.xml b/openupgrade_scripts/scripts/payment_alipay/15.0.2.0/noupdate_changes.xml index e8755591f7bc..5cc1ea9b7baf 100644 --- a/openupgrade_scripts/scripts/payment_alipay/15.0.2.0/noupdate_changes.xml +++ b/openupgrade_scripts/scripts/payment_alipay/15.0.2.0/noupdate_changes.xml @@ -6,7 +6,6 @@ False True - False diff --git a/openupgrade_scripts/scripts/payment_alipay/15.0.2.0/post-migration.py b/openupgrade_scripts/scripts/payment_alipay/15.0.2.0/post-migration.py new file mode 100644 index 000000000000..53e1ffc69d09 --- /dev/null +++ b/openupgrade_scripts/scripts/payment_alipay/15.0.2.0/post-migration.py @@ -0,0 +1,23 @@ +from openupgradelib import openupgrade + + +def _create_account_payment_method_line(env): + # Create account payment method lines from account payment methods + openupgrade.logged_query( + env.cr, + """ + INSERT INTO account_payment_method_line + (name, payment_method_id, journal_id) + SELECT apm.name, apm.id, aj.id + FROM account_payment_method apm + JOIN payment_acquirer pa ON pa.provider = 'alipay' + JOIN account_journal aj ON aj.type = 'bank' AND aj.id = pa.journal_id + WHERE apm.code = 'alipay' + """, + ) + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.load_data(env.cr, "payment_alipay", "15.0.2.0/noupdate_changes.xml") + _create_account_payment_method_line(env) diff --git a/openupgrade_scripts/scripts/payment_alipay/15.0.2.0/upgrade_analysis.txt b/openupgrade_scripts/scripts/payment_alipay/15.0.2.0/upgrade_analysis.txt index 0721f610aa53..d38dc3c7cf6e 100644 --- a/openupgrade_scripts/scripts/payment_alipay/15.0.2.0/upgrade_analysis.txt +++ b/openupgrade_scripts/scripts/payment_alipay/15.0.2.0/upgrade_analysis.txt @@ -1,9 +1,12 @@ ---Models in module 'payment_alipay'--- ---Fields in module 'payment_alipay'--- payment_alipay / payment.acquirer / provider (False) : selection_keys is now '['adyen', 'alipay', 'none']' ('['adyen', 'alipay', 'manual']') +# NOTHING DO DO + ---XML records in module 'payment_alipay'--- NEW account.payment.method: payment_alipay.payment_method_alipay NEW ir.ui.view: payment_alipay.payment_acquirer_form NEW ir.ui.view: payment_alipay.redirect_form DEL ir.ui.view: payment_alipay.alipay_form DEL ir.ui.view: payment_alipay.payment_acquirer_view_form_inherit_payment_alipay +# NOTHING DO DO diff --git a/openupgrade_scripts/scripts/payment_authorize/15.0.2.0/post-migration.py b/openupgrade_scripts/scripts/payment_authorize/15.0.2.0/post-migration.py new file mode 100644 index 000000000000..8f22b1ceed11 --- /dev/null +++ b/openupgrade_scripts/scripts/payment_authorize/15.0.2.0/post-migration.py @@ -0,0 +1,23 @@ +from openupgradelib import openupgrade + + +def _create_account_payment_method_line(env): + # Create account payment method lines from account payment methods + openupgrade.logged_query( + env.cr, + """ + INSERT INTO account_payment_method_line + (name, payment_method_id, journal_id) + SELECT apm.name, apm.id, aj.id + FROM account_payment_method apm + JOIN payment_acquirer pa ON pa.provider = 'authorize' + JOIN account_journal aj ON aj.type = 'bank' AND aj.id = pa.journal_id + WHERE apm.code = 'authorize' + """, + ) + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.load_data(env.cr, "payment_authorize", "15.0.2.0/noupdate_changes.xml") + _create_account_payment_method_line(env) diff --git a/openupgrade_scripts/scripts/payment_buckaroo/15.0.2.0/noupdate_changes.xml b/openupgrade_scripts/scripts/payment_buckaroo/15.0.2.0/noupdate_changes.xml index a3a372f8aae0..1b26394c324b 100644 --- a/openupgrade_scripts/scripts/payment_buckaroo/15.0.2.0/noupdate_changes.xml +++ b/openupgrade_scripts/scripts/payment_buckaroo/15.0.2.0/noupdate_changes.xml @@ -7,7 +7,6 @@ False False - False diff --git a/openupgrade_scripts/scripts/payment_buckaroo/15.0.2.0/post-migration.py b/openupgrade_scripts/scripts/payment_buckaroo/15.0.2.0/post-migration.py new file mode 100644 index 000000000000..d1e22b6f3281 --- /dev/null +++ b/openupgrade_scripts/scripts/payment_buckaroo/15.0.2.0/post-migration.py @@ -0,0 +1,23 @@ +from openupgradelib import openupgrade + + +def _create_account_payment_method_line(env): + # Create account payment method lines from account payment methods + openupgrade.logged_query( + env.cr, + """ + INSERT INTO account_payment_method_line + (name, payment_method_id, journal_id) + SELECT apm.name, apm.id, aj.id + FROM account_payment_method apm + JOIN payment_acquirer pa ON pa.provider = 'buckaroo' + JOIN account_journal aj ON aj.type = 'bank' AND aj.id = pa.journal_id + WHERE apm.code = 'buckaroo' + """, + ) + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.load_data(env.cr, "payment_buckaroo", "15.0.2.0/noupdate_changes.xml") + _create_account_payment_method_line(env) diff --git a/openupgrade_scripts/scripts/payment_mollie/15.0.1.0/post-migration.py b/openupgrade_scripts/scripts/payment_mollie/15.0.1.0/post-migration.py new file mode 100644 index 000000000000..c5861789a72d --- /dev/null +++ b/openupgrade_scripts/scripts/payment_mollie/15.0.1.0/post-migration.py @@ -0,0 +1,22 @@ +from openupgradelib import openupgrade + + +def _create_account_payment_method_line(env): + # Create account payment method lines from account payment methods + openupgrade.logged_query( + env.cr, + """ + INSERT INTO account_payment_method_line + (name, payment_method_id, journal_id) + SELECT apm.name, apm.id, aj.id + FROM account_payment_method apm + JOIN payment_acquirer pa ON pa.provider = 'mollie' + JOIN account_journal aj ON aj.type = 'bank' AND aj.id = pa.journal_id + WHERE apm.code = 'mollie' + """, + ) + + +@openupgrade.migrate() +def migrate(env, version): + _create_account_payment_method_line(env) diff --git a/openupgrade_scripts/scripts/payment_mollie/15.0.1.0/upgrade_analysis.txt b/openupgrade_scripts/scripts/payment_mollie/15.0.1.0/upgrade_analysis.txt index 0bb04af5c0c3..e509af420581 100644 --- a/openupgrade_scripts/scripts/payment_mollie/15.0.1.0/upgrade_analysis.txt +++ b/openupgrade_scripts/scripts/payment_mollie/15.0.1.0/upgrade_analysis.txt @@ -2,7 +2,10 @@ ---Fields in module 'payment_mollie'--- payment_mollie / payment.acquirer / mollie_api_key (char) : NEW payment_mollie / payment.acquirer / provider (False) : previously in module payment_odoo_by_adyen +# NOTHING TO DO + ---XML records in module 'payment_mollie'--- NEW account.payment.method: payment_mollie.payment_method_mollie NEW ir.ui.view: payment_mollie.payment_acquirer_form NEW ir.ui.view: payment_mollie.redirect_form +# NOTHING TO DO diff --git a/openupgrade_scripts/scripts/payment_ogone/15.0.2.0/noupdate_changes.xml b/openupgrade_scripts/scripts/payment_ogone/15.0.2.0/noupdate_changes.xml index 81b0ad358a2c..adb2041ce5a0 100644 --- a/openupgrade_scripts/scripts/payment_ogone/15.0.2.0/noupdate_changes.xml +++ b/openupgrade_scripts/scripts/payment_ogone/15.0.2.0/noupdate_changes.xml @@ -7,7 +7,6 @@ False False - True diff --git a/openupgrade_scripts/scripts/payment_ogone/15.0.2.0/post-migration.py b/openupgrade_scripts/scripts/payment_ogone/15.0.2.0/post-migration.py new file mode 100644 index 000000000000..8eab11bd517c --- /dev/null +++ b/openupgrade_scripts/scripts/payment_ogone/15.0.2.0/post-migration.py @@ -0,0 +1,23 @@ +from openupgradelib import openupgrade + + +def _create_account_payment_method_line(env): + # Create account payment method lines from account payment methods + openupgrade.logged_query( + env.cr, + """ + INSERT INTO account_payment_method_line + (name, payment_method_id, journal_id) + SELECT apm.name, apm.id, aj.id + FROM account_payment_method apm + JOIN payment_acquirer pa ON pa.provider = 'ogone' + JOIN account_journal aj ON aj.type = 'bank' AND aj.id = pa.journal_id + WHERE apm.code = 'ogone' + """, + ) + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.load_data(env.cr, "payment_ogone", "15.0.2.0/noupdate_changes.xml") + _create_account_payment_method_line(env) diff --git a/openupgrade_scripts/scripts/payment_ogone/15.0.2.0/upgrade_analysis.txt b/openupgrade_scripts/scripts/payment_ogone/15.0.2.0/upgrade_analysis.txt index bb061f24f507..69a110d1fa4b 100644 --- a/openupgrade_scripts/scripts/payment_ogone/15.0.2.0/upgrade_analysis.txt +++ b/openupgrade_scripts/scripts/payment_ogone/15.0.2.0/upgrade_analysis.txt @@ -2,6 +2,8 @@ ---Fields in module 'payment_ogone'--- payment_ingenico / payment.acquirer / ogone_alias_usage (char) : DEL payment_ingenico / payment.acquirer / provider (False) : selection_keys is now '['adyen', 'alipay', 'authorize', 'buckaroo', 'mollie', 'none', 'ogone']' ('['adyen', 'alipay', 'authorize', 'buckaroo', 'manual', 'ogone']') +# NOTHING TO DO + ---XML records in module 'payment_ogone'--- NEW account.payment.method: payment_ogone.payment_method_ogone NEW ir.config_parameter: payment_ogone.payment_ogone_hash_function [renamed from payment_ingenico module] @@ -11,3 +13,4 @@ NEW ir.ui.view: payment_ogone.redirect_form DEL ir.ui.view: payment_ingenico.acquirer_form_ogone DEL ir.ui.view: payment_ingenico.ogone_form DEL ir.ui.view: payment_ingenico.ogone_s2s_form +# NOTHING TO DO diff --git a/openupgrade_scripts/scripts/payment_paypal/15.0.2.0/noupdate_changes.xml b/openupgrade_scripts/scripts/payment_paypal/15.0.2.0/noupdate_changes.xml index 853675258c75..b0a77f910766 100644 --- a/openupgrade_scripts/scripts/payment_paypal/15.0.2.0/noupdate_changes.xml +++ b/openupgrade_scripts/scripts/payment_paypal/15.0.2.0/noupdate_changes.xml @@ -6,7 +6,6 @@ False True - False diff --git a/openupgrade_scripts/scripts/payment_paypal/15.0.2.0/post-migration.py b/openupgrade_scripts/scripts/payment_paypal/15.0.2.0/post-migration.py index 5a94ad263faa..801c0a2e428b 100644 --- a/openupgrade_scripts/scripts/payment_paypal/15.0.2.0/post-migration.py +++ b/openupgrade_scripts/scripts/payment_paypal/15.0.2.0/post-migration.py @@ -1,6 +1,23 @@ from openupgradelib import openupgrade +def _create_account_payment_method_line(env): + # Create account payment method lines from account payment methods + openupgrade.logged_query( + env.cr, + """ + INSERT INTO account_payment_method_line + (name, payment_method_id, journal_id) + SELECT apm.name, apm.id, aj.id + FROM account_payment_method apm + JOIN payment_acquirer pa ON pa.provider = 'paypal' + JOIN account_journal aj ON aj.type = 'bank' AND aj.id = pa.journal_id + WHERE apm.code = 'paypal' + """, + ) + + @openupgrade.migrate() def migrate(env, version): openupgrade.load_data(env.cr, "payment_paypal", "15.0.2.0/noupdate_changes.xml") + _create_account_payment_method_line(env) diff --git a/openupgrade_scripts/scripts/payment_payulatam/15.0.2.0/post-migration.py b/openupgrade_scripts/scripts/payment_payulatam/15.0.2.0/post-migration.py new file mode 100644 index 000000000000..13de788a4a5f --- /dev/null +++ b/openupgrade_scripts/scripts/payment_payulatam/15.0.2.0/post-migration.py @@ -0,0 +1,23 @@ +from openupgradelib import openupgrade + + +def _create_account_payment_method_line(env): + # Create account payment method lines from account payment methods + openupgrade.logged_query( + env.cr, + """ + INSERT INTO account_payment_method_line + (name, payment_method_id, journal_id) + SELECT apm.name, apm.id, aj.id + FROM account_payment_method apm + JOIN payment_acquirer pa ON pa.provider = 'payulatam' + JOIN account_journal aj ON aj.type = 'bank' AND aj.id = pa.journal_id + WHERE apm.code = 'payulatam' + """, + ) + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.load_data(env.cr, "payment_payulatam", "15.0.2.0/noupdate_changes.xml") + _create_account_payment_method_line(env) diff --git a/openupgrade_scripts/scripts/payment_payulatam/15.0.2.0/upgrade_analysis.txt b/openupgrade_scripts/scripts/payment_payulatam/15.0.2.0/upgrade_analysis.txt index 800c2ba1f0dd..76e35637e3b6 100644 --- a/openupgrade_scripts/scripts/payment_payulatam/15.0.2.0/upgrade_analysis.txt +++ b/openupgrade_scripts/scripts/payment_payulatam/15.0.2.0/upgrade_analysis.txt @@ -1,9 +1,12 @@ ---Models in module 'payment_payulatam'--- ---Fields in module 'payment_payulatam'--- payment_payulatam / payment.acquirer / provider (False) : selection_keys is now '['adyen', 'alipay', 'authorize', 'buckaroo', 'mollie', 'none', 'ogone', 'paypal', 'payulatam']' ('['adyen', 'alipay', 'authorize', 'buckaroo', 'manual', 'odoo_adyen', 'ogone', 'paypal', 'payulatam']') +# NOTHING TO DO + ---XML records in module 'payment_payulatam'--- NEW account.payment.method: payment_payulatam.payment_method_payulatam NEW ir.ui.view: payment_payulatam.payment_acquirer_form NEW ir.ui.view: payment_payulatam.redirect_form DEL ir.ui.view: payment_payulatam.payment_acquirer_form_inherit_payment_payulatam DEL ir.ui.view: payment_payulatam.payulatam_form +# NOTHING TO DO diff --git a/openupgrade_scripts/scripts/payment_payumoney/15.0.2.0/post-migration.py b/openupgrade_scripts/scripts/payment_payumoney/15.0.2.0/post-migration.py new file mode 100644 index 000000000000..fb7a3030794e --- /dev/null +++ b/openupgrade_scripts/scripts/payment_payumoney/15.0.2.0/post-migration.py @@ -0,0 +1,23 @@ +from openupgradelib import openupgrade + + +def _create_account_payment_method_line(env): + # Create account payment method lines from account payment methods + openupgrade.logged_query( + env.cr, + """ + INSERT INTO account_payment_method_line + (name, payment_method_id, journal_id) + SELECT apm.name, apm.id, aj.id + FROM account_payment_method apm + JOIN payment_acquirer pa ON pa.provider = 'payumoney' + JOIN account_journal aj ON aj.type = 'bank' AND aj.id = pa.journal_id + WHERE apm.code = 'payumoney' + """, + ) + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.load_data(env.cr, "payment_payumoney", "15.0.2.0/noupdate_changes.xml") + _create_account_payment_method_line(env) diff --git a/openupgrade_scripts/scripts/payment_payumoney/15.0.2.0/upgrade_analysis.txt b/openupgrade_scripts/scripts/payment_payumoney/15.0.2.0/upgrade_analysis.txt index 815a57e3fb52..63a2f18b580e 100644 --- a/openupgrade_scripts/scripts/payment_payumoney/15.0.2.0/upgrade_analysis.txt +++ b/openupgrade_scripts/scripts/payment_payumoney/15.0.2.0/upgrade_analysis.txt @@ -1,9 +1,12 @@ ---Models in module 'payment_payumoney'--- ---Fields in module 'payment_payumoney'--- payment_payumoney / payment.acquirer / provider (False) : selection_keys is now '['adyen', 'alipay', 'authorize', 'buckaroo', 'mollie', 'none', 'ogone', 'paypal', 'payulatam', 'payumoney']' ('['adyen', 'alipay', 'authorize', 'buckaroo', 'manual', 'odoo_adyen', 'ogone', 'paypal', 'payulatam', 'payumoney']') +# NOTHING TO DO + ---XML records in module 'payment_payumoney'--- NEW account.payment.method: payment_payumoney.payment_method_payumoney NEW ir.ui.view: payment_payumoney.payment_acquirer_form NEW ir.ui.view: payment_payumoney.redirect_form DEL ir.ui.view: payment_payumoney.payment_acquirer_form_payumoney DEL ir.ui.view: payment_payumoney.payumoney_form +# NOTHING TO DO diff --git a/openupgrade_scripts/scripts/payment_sips/15.0.2.0/post-migration.py b/openupgrade_scripts/scripts/payment_sips/15.0.2.0/post-migration.py new file mode 100644 index 000000000000..e716f4d83c2e --- /dev/null +++ b/openupgrade_scripts/scripts/payment_sips/15.0.2.0/post-migration.py @@ -0,0 +1,23 @@ +from openupgradelib import openupgrade + + +def _create_account_payment_method_line(env): + # Create account payment method lines from account payment methods + openupgrade.logged_query( + env.cr, + """ + INSERT INTO account_payment_method_line + (name, payment_method_id, journal_id) + SELECT apm.name, apm.id, aj.id + FROM account_payment_method apm + JOIN payment_acquirer pa ON pa.provider = 'sips' + JOIN account_journal aj ON aj.type = 'bank' AND aj.id = pa.journal_id + WHERE apm.code = 'sips' + """, + ) + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.load_data(env.cr, "payment_sips", "15.0.2.0/noupdate_changes.xml") + _create_account_payment_method_line(env) diff --git a/openupgrade_scripts/scripts/payment_sips/15.0.2.0/upgrade_analysis.txt b/openupgrade_scripts/scripts/payment_sips/15.0.2.0/upgrade_analysis.txt index dc1a1208b089..5021c3464804 100644 --- a/openupgrade_scripts/scripts/payment_sips/15.0.2.0/upgrade_analysis.txt +++ b/openupgrade_scripts/scripts/payment_sips/15.0.2.0/upgrade_analysis.txt @@ -1,9 +1,12 @@ ---Models in module 'payment_sips'--- ---Fields in module 'payment_sips'--- payment_sips / payment.acquirer / provider (False) : selection_keys is now '['adyen', 'alipay', 'authorize', 'buckaroo', 'mollie', 'none', 'ogone', 'paypal', 'payulatam', 'payumoney', 'sips']' ('['adyen', 'alipay', 'authorize', 'buckaroo', 'manual', 'odoo_adyen', 'ogone', 'paypal', 'payulatam', 'payumoney', 'sips']') +# NOTHING TO DO + ---XML records in module 'payment_sips'--- NEW account.payment.method: payment_sips.payment_method_sips NEW ir.ui.view: payment_sips.payment_acquirer_form NEW ir.ui.view: payment_sips.redirect_form DEL ir.ui.view: payment_sips.acquirer_form_sips DEL ir.ui.view: payment_sips.sips_form +# NOTHING TO DO diff --git a/openupgrade_scripts/scripts/payment_stripe/15.0.2.0/post-migration.py b/openupgrade_scripts/scripts/payment_stripe/15.0.2.0/post-migration.py new file mode 100644 index 000000000000..43c17b708837 --- /dev/null +++ b/openupgrade_scripts/scripts/payment_stripe/15.0.2.0/post-migration.py @@ -0,0 +1,23 @@ +from openupgradelib import openupgrade + + +def _create_account_payment_method_line(env): + # Create account payment method lines from account payment methods + openupgrade.logged_query( + env.cr, + """ + INSERT INTO account_payment_method_line + (name, payment_method_id, journal_id) + SELECT apm.name, apm.id, aj.id + FROM account_payment_method apm + JOIN payment_acquirer pa ON pa.provider = 'stripe' + JOIN account_journal aj ON aj.type = 'bank' AND aj.id = pa.journal_id + WHERE apm.code = 'stripe' + """, + ) + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.load_data(env.cr, "payment_stripe", "15.0.2.0/noupdate_changes.xml") + _create_account_payment_method_line(env) diff --git a/openupgrade_scripts/scripts/payment_stripe/15.0.2.0/upgrade_analysis.txt b/openupgrade_scripts/scripts/payment_stripe/15.0.2.0/upgrade_analysis.txt index d22230c0e64a..4b260069e889 100644 --- a/openupgrade_scripts/scripts/payment_stripe/15.0.2.0/upgrade_analysis.txt +++ b/openupgrade_scripts/scripts/payment_stripe/15.0.2.0/upgrade_analysis.txt @@ -3,6 +3,8 @@ payment_stripe / payment.acquirer / provider (False) : selection_keys is now '['adyen', 'alipay', 'authorize', 'buckaroo', 'mollie', 'none', 'ogone', 'paypal', 'payulatam', 'payumoney', 'sips', 'stripe']' ('['adyen', 'alipay', 'authorize', 'buckaroo', 'manual', 'odoo_adyen', 'ogone', 'paypal', 'payulatam', 'payumoney', 'sips', 'stripe']') payment_stripe / payment.acquirer / stripe_image_url (char) : DEL payment_stripe / payment.transaction / stripe_payment_intent_secret (char): DEL +# NOTHING TO DO + ---XML records in module 'payment_stripe'--- NEW account.payment.method: payment_stripe.payment_method_stripe NEW ir.actions.act_window: payment_stripe.action_payment_acquirer_onboarding @@ -13,3 +15,4 @@ DEL ir.ui.view: payment_stripe.acquirer_form_stripe DEL ir.ui.view: payment_stripe.assets_frontend DEL ir.ui.view: payment_stripe.stripe_form DEL ir.ui.view: payment_stripe.stripe_s2s_form +# NOTHING TO DO diff --git a/openupgrade_scripts/scripts/payment_transfer/15.0.2.0/noupdate_changes.xml b/openupgrade_scripts/scripts/payment_transfer/15.0.2.0/noupdate_changes.xml index 04ca216e8941..aa2f7a39fd57 100644 --- a/openupgrade_scripts/scripts/payment_transfer/15.0.2.0/noupdate_changes.xml +++ b/openupgrade_scripts/scripts/payment_transfer/15.0.2.0/noupdate_changes.xml @@ -3,7 +3,6 @@ - False False diff --git a/openupgrade_scripts/scripts/payment_transfer/15.0.2.0/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/payment_transfer/15.0.2.0/upgrade_analysis_work.txt index ed9188815aa8..5015bb3493b8 100644 --- a/openupgrade_scripts/scripts/payment_transfer/15.0.2.0/upgrade_analysis_work.txt +++ b/openupgrade_scripts/scripts/payment_transfer/15.0.2.0/upgrade_analysis_work.txt @@ -3,6 +3,7 @@ payment_transfer / payment.acquirer / provider (False) : selection_keys is now '['adyen', 'alipay', 'authorize', 'buckaroo', 'mollie', 'none', 'ogone', 'paypal', 'payulatam', 'payumoney', 'sips', 'stripe', 'transfer']' ('['adyen', 'alipay', 'authorize', 'buckaroo', 'manual', 'odoo_adyen', 'ogone', 'paypal', 'payulatam', 'payumoney', 'sips', 'stripe', 'transfer']') payment_transfer / payment.acquirer / qr_code (boolean) : previously in module payment # NOTHING TO DO: don't affect old data + ---XML records in module 'payment_transfer'--- NEW ir.ui.view: payment_transfer.payment_acquirer_form NEW ir.ui.view: payment_transfer.redirect_form