-
-
Notifications
You must be signed in to change notification settings - Fork 708
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
477 additions
and
362 deletions.
There are no files selected for viewing
350 changes: 0 additions & 350 deletions
350
openupgrade_scripts/scripts/payment/17.0.2.0/noupdate_changes.xml
Large diffs are not rendered by default.
Oops, something went wrong.
405 changes: 405 additions & 0 deletions
405
openupgrade_scripts/scripts/payment/17.0.2.0/noupdate_changes_work.xml
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
24 changes: 24 additions & 0 deletions
24
openupgrade_scripts/scripts/payment/tests/data_payment_migration.py
This file contains 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,24 @@ | ||
env = locals().get("env") | ||
# create a payment token and a transaction to | ||
# see if our migration migrates them correctly | ||
demo_provider = env.ref("payment.payment_provider_demo") | ||
demo_provider.state = "test" | ||
token = env["payment.token"].create( | ||
{ | ||
"provider_id": demo_provider.id, | ||
"partner_id": env.user.partner_id.id, | ||
"provider_ref": "hello world", | ||
} | ||
) | ||
env["payment.transaction"].create( | ||
{ | ||
"provider_id": demo_provider.id, | ||
"token_id": token.id, | ||
"reference": "hello world", | ||
"amount": 42, | ||
"currency_id": demo_provider.main_currency_id.id, | ||
"state": "pending", | ||
"partner_id": env.user.partner_id.id, | ||
} | ||
) | ||
env.cr.commit() |
13 changes: 13 additions & 0 deletions
13
openupgrade_scripts/scripts/payment/tests/test_payment_migration.py
This file contains 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,13 @@ | ||
from odoo.tests import TransactionCase | ||
|
||
from odoo.addons.openupgrade_framework import openupgrade_test | ||
|
||
|
||
@openupgrade_test | ||
class TestPaymentMigration(TransactionCase): | ||
def test_no_transactions_without_method(self): | ||
payment_transactions = self.env["payment.transaction"].search([]) | ||
self.assertTrue(payment_transactions) | ||
self.assertFalse( | ||
payment_transactions.filtered_domain([("payment_method_id", "=", False)]) | ||
) |