-
-
Notifications
You must be signed in to change notification settings - Fork 813
[19.0][OU-ADD] pos_viva_com: rename viva_wallet_* fields to viva_com_* #5644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dnplkndll
wants to merge
1
commit into
OCA:19.0
Choose a base branch
from
ledoent:19.0-mig-pos-viva-com-rename
base: 19.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
openupgrade_scripts/scripts/pos_viva_com/19.0.1.0/pre-migration.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| from openupgradelib import openupgrade | ||
|
|
||
| _renamed_fields = [ | ||
| ( | ||
| "pos.payment.method", | ||
| "pos_payment_method", | ||
| "viva_wallet_api_key", | ||
| "viva_com_api_key", | ||
| ), | ||
| ( | ||
| "pos.payment.method", | ||
| "pos_payment_method", | ||
| "viva_wallet_bearer_token", | ||
| "viva_com_bearer_token", | ||
| ), | ||
| ( | ||
| "pos.payment.method", | ||
| "pos_payment_method", | ||
| "viva_wallet_client_id", | ||
| "viva_com_client_id", | ||
| ), | ||
| ( | ||
| "pos.payment.method", | ||
| "pos_payment_method", | ||
| "viva_wallet_client_secret", | ||
| "viva_com_client_secret", | ||
| ), | ||
| ( | ||
| "pos.payment.method", | ||
| "pos_payment_method", | ||
| "viva_wallet_latest_response", | ||
| "viva_com_latest_response", | ||
| ), | ||
| ( | ||
| "pos.payment.method", | ||
| "pos_payment_method", | ||
| "viva_wallet_merchant_id", | ||
| "viva_com_merchant_id", | ||
| ), | ||
| ( | ||
| "pos.payment.method", | ||
| "pos_payment_method", | ||
| "viva_wallet_terminal_id", | ||
| "viva_com_terminal_id", | ||
| ), | ||
| ( | ||
| "pos.payment.method", | ||
| "pos_payment_method", | ||
| "viva_wallet_test_mode", | ||
| "viva_com_test_mode", | ||
| ), | ||
| ( | ||
| "pos.payment.method", | ||
| "pos_payment_method", | ||
| "viva_wallet_webhook_verification_key", | ||
| "viva_com_webhook_verification_key", | ||
| ), | ||
| ] | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(env, version): | ||
| openupgrade.rename_fields(env, _renamed_fields) |
28 changes: 28 additions & 0 deletions
28
openupgrade_scripts/scripts/pos_viva_com/19.0.1.0/tests/test_pos_viva_com_migration.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| from odoo.tests import TransactionCase | ||
|
|
||
| from odoo.addons.openupgrade_framework import openupgrade_test | ||
|
|
||
|
|
||
| @openupgrade_test | ||
| class TestPosVivaComMigration(TransactionCase): | ||
| def test_credentials_preserved(self): | ||
| """All 9 viva_wallet_* fields renamed to viva_com_* with values preserved.""" | ||
| self.env.cr.execute( | ||
| """ | ||
| SELECT id FROM pos_payment_method | ||
| WHERE viva_com_api_key = 'seed_api_key' | ||
| AND viva_com_bearer_token = 'seed_bearer_token' | ||
| AND viva_com_client_id = 'seed_client_id' | ||
| AND viva_com_client_secret = 'seed_client_secret' | ||
| AND viva_com_latest_response::text = '{"seed": true}' | ||
| AND viva_com_merchant_id = 'seed_merchant' | ||
| AND viva_com_terminal_id = 'seed_terminal' | ||
| AND viva_com_test_mode IS TRUE | ||
| AND viva_com_webhook_verification_key = 'seed_webhook_key' | ||
| """ | ||
| ) | ||
| self.assertTrue( | ||
| self.env.cr.fetchone(), | ||
| "Expected one pos.payment.method with all 9 seeded " | ||
| "viva_wallet_* credentials migrated to viva_com_*.", | ||
| ) |
32 changes: 32 additions & 0 deletions
32
openupgrade_scripts/scripts/pos_viva_com/19.0.1.0/upgrade_analysis_work.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| ---Models in module 'pos_viva_com'--- | ||
|
|
||
| # NOTHING TO DO | ||
|
|
||
| ---Fields in module 'pos_viva_com'--- | ||
| pos_viva_com / pos.payment / viva_com_session_id (char) : NEW | ||
| pos_viva_com / pos.payment.method / viva_com_api_key (char) : NEW | ||
| pos_viva_com / pos.payment.method / viva_com_bearer_token (char) : NEW hasdefault: default | ||
| pos_viva_com / pos.payment.method / viva_com_client_id (char) : NEW | ||
| pos_viva_com / pos.payment.method / viva_com_client_secret (char) : NEW | ||
| pos_viva_com / pos.payment.method / viva_com_latest_response (json): NEW | ||
| pos_viva_com / pos.payment.method / viva_com_merchant_id (char) : NEW | ||
| pos_viva_com / pos.payment.method / viva_com_terminal_id (char) : NEW | ||
| pos_viva_com / pos.payment.method / viva_com_test_mode (boolean) : NEW | ||
| pos_viva_com / pos.payment.method / viva_com_webhook_verification_key (char): NEW | ||
| pos_viva_wallet / pos.payment.method / viva_wallet_api_key (char) : DEL | ||
| pos_viva_wallet / pos.payment.method / viva_wallet_bearer_token (char): DEL | ||
| pos_viva_wallet / pos.payment.method / viva_wallet_client_id (char) : DEL | ||
| pos_viva_wallet / pos.payment.method / viva_wallet_client_secret (char): DEL | ||
| pos_viva_wallet / pos.payment.method / viva_wallet_latest_response (json): DEL | ||
| pos_viva_wallet / pos.payment.method / viva_wallet_merchant_id (char): DEL | ||
| pos_viva_wallet / pos.payment.method / viva_wallet_terminal_id (char): DEL | ||
| pos_viva_wallet / pos.payment.method / viva_wallet_test_mode (boolean): DEL | ||
| pos_viva_wallet / pos.payment.method / viva_wallet_webhook_verification_key (char): DEL | ||
|
|
||
| # DONE: pre-migration: rename fields | ||
|
|
||
| ---XML records in module 'pos_viva_com'--- | ||
| NEW ir.ui.view: pos_viva_com.pos_payment_method_view_form_inherit_pos_viva_com | ||
| DEL ir.ui.view: pos_viva_wallet.pos_payment_method_view_form_inherit_pos_viva_wallet | ||
|
|
||
| # NOTHING TO DO | ||
34 changes: 34 additions & 0 deletions
34
openupgrade_scripts/scripts/pos_viva_com/tests/data_pos_viva_com_migration.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| env = locals().get("env") | ||
| method = env["pos.payment.method"].search([], limit=1) | ||
| if not method: | ||
| company = env.ref("base.main_company") | ||
| journal = env["account.journal"].search( | ||
| [("type", "in", ("cash", "bank")), ("company_id", "=", company.id)], | ||
| limit=1, | ||
| ) | ||
| if journal: | ||
| method = env["pos.payment.method"].create( | ||
| { | ||
| "name": "OpenUpgrade Viva Seed", | ||
| "journal_id": journal.id, | ||
| "company_id": company.id, | ||
| } | ||
| ) | ||
| if method: | ||
| env.cr.execute( | ||
| """ | ||
| UPDATE pos_payment_method SET | ||
| viva_wallet_api_key = 'seed_api_key', | ||
| viva_wallet_bearer_token = 'seed_bearer_token', | ||
| viva_wallet_client_id = 'seed_client_id', | ||
| viva_wallet_client_secret = 'seed_client_secret', | ||
| viva_wallet_latest_response = '{"seed": true}'::jsonb, | ||
| viva_wallet_merchant_id = 'seed_merchant', | ||
| viva_wallet_terminal_id = 'seed_terminal', | ||
| viva_wallet_test_mode = TRUE, | ||
| viva_wallet_webhook_verification_key = 'seed_webhook_key' | ||
| WHERE id = %s | ||
| """, | ||
| (method.id,), | ||
| ) | ||
| env.cr.commit() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one should be marked as NOTHING TO DO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
# NOTHING TO DOafter the empty Models section in d28c7e6.