diff --git a/addons/payment/migrations/13.0.1.0/noupdate_changes.xml b/addons/payment/migrations/13.0.1.0/noupdate_changes.xml index 16be77eedead..b2808caa250d 100644 --- a/addons/payment/migrations/13.0.1.0/noupdate_changes.xml +++ b/addons/payment/migrations/13.0.1.0/noupdate_changes.xml @@ -1,7 +1,7 @@ - + Credit Card (powered by Adyen) @@ -19,37 +19,57 @@
  • Embedded Credit Card Form
  • - + Credit Card (powered by Authorize) - + Credit Card (powered by Buckaroo) + + +

    + Ingenico Payment Services (formerly Ogone) supports a wide range of payment methods: credit cards, debit cards, bank transfers, Bancontact, iDeal, Giropay. +

    +
      +
    • Online Payment
    • +
    • Payment Status Tracking
    • +
    • Subscriptions
    • +
    • Save Cards
    • +
    • Embedded Credit Card Form
    • +
    +
    + + + + Credit Card (powered by Ingenico) + +
    - + PayPal - + Credit Card (powered by PayUmoney) - + Credit Card (powered by Sips) - + Credit Card (powered by Stripe) - +
    diff --git a/addons/payment/migrations/13.0.1.0/openupgrade_analysis_work.txt b/addons/payment/migrations/13.0.1.0/openupgrade_analysis_work.txt new file mode 100644 index 000000000000..0474e54729a2 --- /dev/null +++ b/addons/payment/migrations/13.0.1.0/openupgrade_analysis_work.txt @@ -0,0 +1,54 @@ +---Models in module 'payment'--- +new model payment.link.wizard [transient] +# NOTHING TO DO + +---Fields in module 'payment'--- +payment / account.invoice / transaction_ids (many2many) : DEL relation: payment.transaction +payment / account.move / transaction_ids (many2many) : NEW relation: payment.transaction +payment / payment.transaction / invoice_ids (many2many) : relation is now 'account.move' ('account.invoice') [nothing to do] +# DONE: post-migration updated new ids + +payment / payment.acquirer / auth_msg (html) : NEW hasdefault +payment / payment.acquirer / check_validity (boolean) : NEW +payment / payment.acquirer / color (integer) : NEW isfunction: function, stored +payment / payment.acquirer / display_as (char) : NEW +# NOTHING TO DO + +payment / payment.acquirer / environment (selection) : DEL required, selection_keys: ['prod', 'test'], req_default: function +payment / payment.acquirer / state (selection) : NEW required, selection_keys: ['disabled', 'enabled', 'test'], req_default: function, hasdefault +# DONE: Pre-migration renamed to state + +payment / payment.acquirer / image (binary) : DEL attachment: True +payment / payment.acquirer / image_128 (binary) : NEW attachment: True +payment / payment.acquirer / image_medium (binary) : DEL attachment: True +payment / payment.acquirer / image_small (binary) : DEL attachment: True +# DONE: Pre-migration renamed to image_128 + +payment / payment.acquirer / module_state (selection) : is now stored +payment / payment.acquirer / post_msg (html) : DEL +payment / payment.acquirer / specific_countries (boolean) : DEL +payment / payment.acquirer / website_published (boolean) : DEL +payment / payment.acquirer / error_msg (html) : DEL +payment / payment.token / company_id (many2one) : NEW relation: res.company, isrelated: related, stored +# NOTHING TO DO: many2many table didn't changed + +---XML records in module 'payment'--- +NEW ir.actions.act_window: payment.action_invoice_order_generate_link +NEW ir.ui.view: payment.payment_link_wizard_view_form +NEW payment.acquirer: payment.payment_acquirer_alipay (noupdate) +NEW payment.acquirer: payment.payment_acquirer_payulatam (noupdate) +NEW payment.acquirer: payment.payment_acquirer_sepa_direct_debit (noupdate) +NEW payment.icon: payment.payment_icon_cc_codensa_easy_credit +NEW payment.icon: payment.payment_icon_cc_ideal +NEW payment.icon: payment.payment_icon_cc_webmoney +NEW payment.icon: payment.payment_icon_cc_western_union +DEL ir.ui.menu: payment.root_payment_menu [renamed to account module] +DEL ir.ui.view: payment.view_account_payment_invoice_form_inherit_payment +# NOTHING TO DO + +DEL payment.acquirer: payment.payment_acquirer_custom (noupdate) +# DONE: Post-migration + +NEW payment.acquirer: payment.payment_acquirer_ingenico (noupdate) +DEL payment.acquirer: payment.payment_acquirer_ogone (noupdate) +# DONE: Pre-migrations renamed diff --git a/addons/payment/migrations/13.0.1.0/post-migration.py b/addons/payment/migrations/13.0.1.0/post-migration.py new file mode 100644 index 000000000000..321a00f26e1c --- /dev/null +++ b/addons/payment/migrations/13.0.1.0/post-migration.py @@ -0,0 +1,39 @@ +# Copyright 2020 Payam Yasaie +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openupgradelib import openupgrade + +unlink_by_xmlid = [ + 'payment.payment_acquirer_custom' +] + + +def map_payment_acquirer_state(cr): + openupgrade.logged_query( + cr, """ + UPDATE payment_acquirer + SET state = CASE WHEN {website_published} = TRUE THEN 'enabled' + ELSE 'disabled' END + WHERE state = 'prod'""".format( + website_published=openupgrade.get_legacy_name('website_published') + ) + ) + + +def update_account_invoice_transaction_rel_table(cr): + openupgrade.logged_query( + cr, """ + UPDATE account_invoice_transaction_rel aitr + SET invoice_id = am.id + FROM account_move am + WHERE am.old_invoice_id = aitr.{} + """.format(openupgrade.get_legacy_name('invoice_id')) + ) + + +@openupgrade.migrate(use_env=True) +def migrate(env, version): + map_payment_acquirer_state(env.cr) + update_account_invoice_transaction_rel_table(env.cr) + openupgrade.delete_records_safely_by_xml_id(env, unlink_by_xmlid) + openupgrade.load_data(env.cr, 'payment', 'migrations/13.0.1.0/noupdate_changes.xml') diff --git a/addons/payment/migrations/13.0.1.0/pre-migration.py b/addons/payment/migrations/13.0.1.0/pre-migration.py new file mode 100644 index 000000000000..7eaf7ca7cc28 --- /dev/null +++ b/addons/payment/migrations/13.0.1.0/pre-migration.py @@ -0,0 +1,44 @@ +# Copyright 2020 Payam Yasaie +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openupgradelib import openupgrade + +_column_copies = { + 'account_invoice_transaction_rel': [ + ('invoice_id', None, None), + ], + +} + +_column_renames = { + 'payment_acquirer': [ + ('website_published', None), + ], + +} + +_field_renames = [ + ('payment.acquirer', 'payment_acquirer', 'image_medium', 'image_128'), + ('payment.acquirer', 'payment_acquirer', 'environment', 'state'), +] + +_xmlid_renames = [ + ('payment.payment_acquirer_ogone', 'payment.payment_acquirer_ingenico'), +] + + +@openupgrade.migrate(use_env=True) +def migrate(env, version): + openupgrade.rename_fields(env, _field_renames) + openupgrade.copy_columns(env.cr, _column_copies) + openupgrade.rename_columns(env.cr, _column_renames) + openupgrade.rename_xmlids(env.cr, _xmlid_renames) + # Fix image of payment.acquirer after renaming column to image_128 + openupgrade.logged_query( + env.cr, + """ + UPDATE ir_attachment + SET res_field = 'image_128' + WHERE res_field = 'image_medium' and res_model = 'payment.acquirer' + """, + ) diff --git a/odoo/openupgrade/doc/source/modules120-130.rst b/odoo/openupgrade/doc/source/modules120-130.rst index da5f8ee20728..7d7b17b02b9b 100644 --- a/odoo/openupgrade/doc/source/modules120-130.rst +++ b/odoo/openupgrade/doc/source/modules120-130.rst @@ -459,7 +459,7 @@ missing in the new release are marked with |del|. +----------------------------------------------+-------------------------------------------------+ |partner_autocomplete_address_extended | Nothing to do | +----------------------------------------------+-------------------------------------------------+ -|payment | | +|payment | Done | +----------------------------------------------+-------------------------------------------------+ |payment_adyen | | +----------------------------------------------+-------------------------------------------------+