Skip to content

Commit

Permalink
[OU-ADD] payment
Browse files Browse the repository at this point in the history
Works:

- acquirer is now provider, so rename models, tables and fields.
- Rename XML-IDs
- Loads noupdate_changes.

Details in the upgrade_analysis_work file.

Co-Authored-By: Pedro M. Baeza <pedro.baeza@tecnativa.com>
  • Loading branch information
remytms and pedrobaeza committed Oct 27, 2023
1 parent b450587 commit c0a9ebc
Show file tree
Hide file tree
Showing 5 changed files with 504 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docsource/modules150-160.rst
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ Module coverage 15.0 -> 16.0
+-------------------------------------------------+----------------------+-------------------------------------------------+
| partner_autocomplete | Nothing to do |No DB layout changes. |
+-------------------------------------------------+----------------------+-------------------------------------------------+
| payment | | |
| payment | Done | |
+-------------------------------------------------+----------------------+-------------------------------------------------+
| payment_adyen | | |
+-------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
32 changes: 32 additions & 0 deletions openupgrade_scripts/scripts/payment/16.0.2.0/noupdate_changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,36 @@
<record id="payment_transaction_user_rule" model="ir.rule">
<field name="groups" eval="[(4, ref('base.group_user')), (4, ref('base.group_portal'))]"/>
</record>

<!-- payment_provider form 16.0 -->
<record id="payment_provider_adyen" model="payment.provider">
<field name="image_128" type="base64" file="payment_adyen/static/description/icon.png"/>
</record>
<record id="payment_provider_authorize" model="payment.provider">
<field name="image_128"
type="base64"
file="payment_authorize/static/description/icon.png"/>
</record>
<record id="payment_provider_buckaroo" model="payment.provider">
<field name="image_128"
type="base64"
file="payment_buckaroo/static/description/icon.png"/>
</record>
<record id="payment_provider_mollie" model="payment.provider">
<field name="image_128" type="base64" file="payment_mollie/static/description/icon.png"/>
</record>
<record id="payment_provider_paypal" model="payment.provider">
<field name="image_128" type="base64" file="payment_paypal/static/description/icon.png"/>
</record>
<record id="payment_provider_sips" model="payment.provider">
<field name="image_128" type="base64" file="payment_sips/static/description/icon.png"/>
</record>
<record id="payment_provider_stripe" model="payment.provider">
<field name="image_128" type="base64" file="payment_stripe/static/description/icon.png"/>
</record>
<record id="payment_provider_transfer" model="payment.provider">
<field name="image_128"
type="base64"
file="payment_custom/static/description/icon.png"/>
</record>
</odoo>
19 changes: 19 additions & 0 deletions openupgrade_scripts/scripts/payment/16.0.2.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2023 Coop IT Easy SC
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
openupgrade.load_data(env.cr, "payment", "16.0.2.0/noupdate_changes.xml")
openupgrade.delete_records_safely_by_xml_id(
env,
[
"payment.payment_acquirer_alipay",
"payment.payment_acquirer_ogone",
"payment.payment_acquirer_payulatam",
"payment.payment_acquirer_payumoney",
"payment.payment_acquirer_test",
],
)
213 changes: 213 additions & 0 deletions openupgrade_scripts/scripts/payment/16.0.2.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
# Copyright 2023 Coop IT Easy SC
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade

_model_renames = [
("payment.acquirer", "payment.provider"),
]

_table_renames = [
("payment_acquirer", "payment_provider"),
("payment_acquirer_payment_icon_rel", "payment_provider_payment_icon_rel"),
]

_field_renames = [
(
"account.payment.method.line",
"account_payment_method_line",
"payment_acquirer_id",
"payment_provider_id",
),
(
"account.payment.method.line",
"account_payment_method_line",
"payment_acquirer_state",
"payment_provider_state",
),
(
"payment.icon",
"payment_icon",
"acquirer_ids",
"provider_ids",
),
(
"payment.token",
"payment_token",
"acquirer_id",
"provider_id",
),
(
"payment.token",
"payment_token",
"acquirer_ref",
"provider_ref",
),
(
"payment.token",
"payment_token",
"name",
"payment_details",
),
(
"payment.transaction",
"payment_transaction",
"acquirer_id",
"provider_id",
),
(
"payment.transaction",
"payment_transaction",
"acquirer_reference",
"provider_reference",
),
(
"res.company",
"res_company",
"payment_acquirer_onboarding_state",
"payment_provider_onboarding_state",
),
]

_xmlid_renames = [
(
"payment.action_invoice_order_generate_link",
"account_payment.action_invoice_order_generate_link",
),
(
"payment.action_payment_acquirer",
"payment.action_payment_provider",
),
(
"payment.payment_acquirer_onboarding_wizard",
"payment.payment_provider_onboarding_wizard",
),
(
"payment.payment_acquirer_system",
"payment.payment_provider_system",
),
(
"payment.payment_link_wizard",
"account_payment.payment_link_wizard",
),
(
"payment.payment_refund_wizard",
"account_payment.payment_refund_wizard",
),
(
"payment.payment_acquirer_company_rule",
"payment.payment_provider_company_rule",
),
(
"payment.payment_token_billing_rule",
"account_payment.payment_token_billing_rule",
),
(
"payment.payment_transaction_billing_rule",
"account_payment.payment_transaction_billing_rule",
),
(
"payment.payment_acquirer_menu",
"account_payment.payment_provider_menu",
),
(
"payment.payment_icon_menu",
"account_payment.payment_icon_menu",
),
(
"payment.payment_token_menu",
"account_payment.payment_token_menu",
),
(
"payment.payment_transaction_menu",
"account_payment.payment_transaction_menu",
),
(
"payment.account_invoice_view_form_inherit_payment",
"account_payment.account_invoice_view_form_inherit_payment",
),
(
"payment.payment_acquirer_form",
"account_payment.payment_provider_form",
),
(
"payment.payment_acquirer_kanban",
"account_payment.payment_provider_kanban",
),
(
"payment.payment_acquirer_list",
"account_payment.payment_provider_list",
),
(
"payment.payment_acquirer_onboarding_wizard_form",
"payment.payment_provider_onboarding_wizard_form",
),
(
"payment.payment_acquirer_search",
"account_payment.payment_provider_search",
),
(
"payment.payment_refund_wizard_view_form",
"account_payment.payment_refund_wizard_view_form",
),
(
"payment.view_account_journal_form",
"account_payment.view_account_journal_form",
),
(
"payment.view_account_payment_form_inherit_payment",
"account_payment.view_account_payment_form_inherit_payment",
),
(
"payment.view_account_payment_register_form_inherit_payment",
"account_payment.view_account_payment_register_form_inherit_payment",
),
(
"payment.payment_acquirer_adyen",
"payment.payment_provider_adyen",
),
(
"payment.payment_acquirer_authorize",
"payment.payment_provider_authorize",
),
(
"payment.payment_acquirer_buckaroo",
"payment.payment_provider_buckaroo",
),
(
"payment.payment_acquirer_mollie",
"payment.payment_provider_mollie",
),
(
"payment.payment_acquirer_paypal",
"payment.payment_provider_paypal",
),
(
"payment.payment_acquirer_sepa_direct_debit",
"payment.payment_provider_sepa_direct_debit",
),
(
"payment.payment_acquirer_sips",
"payment.payment_provider_sips",
),
(
"payment.payment_acquirer_stripe",
"payment.payment_provider_stripe",
),
(
"payment.payment_acquirer_test",
"payment.payment_provider_test",
),
(
"payment.payment_acquirer_transfer",
"payment.payment_provider_transfer",
),
]


@openupgrade.migrate()
def migrate(env, version):
openupgrade.rename_models(env.cr, _model_renames)
openupgrade.rename_tables(env.cr, _table_renames)
openupgrade.rename_fields(env, _field_renames)
openupgrade.rename_xmlids(env.cr, _xmlid_renames)
Loading

0 comments on commit c0a9ebc

Please sign in to comment.