diff --git a/modules/account_payment_braintree/__init__.py b/modules/account_payment_braintree/__init__.py
index bd0f5a4067..964dd68948 100644
--- a/modules/account_payment_braintree/__init__.py
+++ b/modules/account_payment_braintree/__init__.py
@@ -24,7 +24,6 @@ def register():
module='account_payment_braintree', type_='model')
Pool.register(
account.PaymentBraintreeCustomerPaymentMethodDelete,
- account.PaymentBraintreeCheckout,
party.Replace,
module='account_payment_braintree', type_='wizard')
Pool.register(
diff --git a/modules/account_payment_braintree/account.py b/modules/account_payment_braintree/account.py
index 65908e139c..490796b023 100644
--- a/modules/account_payment_braintree/account.py
+++ b/modules/account_payment_braintree/account.py
@@ -30,8 +30,7 @@ from trytond.report import Report
from trytond.tools import sql_pairing
from trytond.transaction import Transaction
from trytond.url import http_host
-from trytond.wizard import (
- Button, StateAction, StateTransition, StateView, Wizard)
+from trytond.wizard import Button, StateTransition, StateView, Wizard
from .common import BraintreeCustomerMethodMixin
from .exceptions import BraintreeAccountWarning
@@ -115,20 +114,24 @@ class CheckoutMixin:
return super().copy(records, default=default)
@classmethod
- @ModelView.button_action('account_payment_braintree.wizard_checkout')
+ @ModelView.button_action('account_payment_braintree.url_checkout')
def braintree_checkout(cls, records):
for record in records:
record.braintree_checkout_id = uuid.uuid4().hex
- cls.save(records)
+ record.save()
+ return {
+ 'url': record.braintree_checkout_url,
+ }
@property
def braintree_checkout_url(self):
pool = Pool()
database = Transaction().database.name
- Checkout = pool.get(
- 'account.payment.braintree.checkout', type='wizard')
- action = Checkout.checkout.get_action()
- return action['url'] % {
+ ModelData = pool.get('ir.model.data')
+ URL = pool.get('ir.action.url')
+ action = URL(ModelData.get_id(
+ 'account_payment_braintree.url_checkout'))
+ return action.url % {
'http_host': http_host(),
'database': database,
'model': self.__class__.__name__,
@@ -1261,15 +1264,5 @@ class PaymentBraintreeCustomerPaymentMethodDeleteAsk(ModelView):
return methods
-class PaymentBraintreeCheckout(Wizard):
- __name__ = 'account.payment.braintree.checkout'
- start_state = 'checkout'
- checkout = StateAction('account_payment_braintree.url_checkout')
-
- def do_checkout(self, action):
- action['url'] = self.record.braintree_checkout_url
- return action, {}
-
-
class PaymentBraintreeCheckoutPage(Report):
__name__ = 'account.payment.braintree.checkout'
diff --git a/modules/account_payment_braintree/account.xml b/modules/account_payment_braintree/account.xml
index 4617ca2eba..a08087a707 100644
--- a/modules/account_payment_braintree/account.xml
+++ b/modules/account_payment_braintree/account.xml
@@ -293,11 +293,6 @@ this repository contains the full copyright notices and license terms. -->
customer_payment_method_delete_ask_form
-
- Braintree Checkout
- account.payment.braintree.checkout
-
-
Braintree Checkout
%(http_host)s/%(database)s/account_payment_braintree/checkout/%(model)s/%(id)s
diff --git a/modules/account_payment_stripe/__init__.py b/modules/account_payment_stripe/__init__.py
index cb01d77b99..eb83359b8a 100644
--- a/modules/account_payment_stripe/__init__.py
+++ b/modules/account_payment_stripe/__init__.py
@@ -24,7 +24,6 @@ def register():
ir.Cron,
module='account_payment_stripe', type_='model')
Pool.register(
- payment.Checkout,
payment.CustomerSourceDetach,
party.Replace,
module='account_payment_stripe', type_='wizard')
diff --git a/modules/account_payment_stripe/payment.py b/modules/account_payment_stripe/payment.py
index 22dc10da35..63a2255b66 100644
--- a/modules/account_payment_stripe/payment.py
+++ b/modules/account_payment_stripe/payment.py
@@ -30,8 +30,7 @@ from trytond.tools import sql_pairing
from trytond.tools.email_ import set_from_header
from trytond.transaction import Transaction
from trytond.url import http_host
-from trytond.wizard import (
- Button, StateAction, StateTransition, StateView, Wizard)
+from trytond.wizard import Button, StateTransition, StateView, Wizard
from .common import StripeCustomerMethodMixin
from .exceptions import StripeAccountWarning
@@ -87,19 +86,23 @@ class CheckoutMixin:
return super().copy(records, default=default)
@classmethod
- @ModelView.button_action('account_payment_stripe.wizard_checkout')
+ @ModelView.button_action('account_payment_stripe.url_checkout')
def stripe_checkout(cls, records):
for record in records:
record.stripe_checkout_id = uuid.uuid4().hex
- cls.save(records)
+ record.save()
+ return {
+ 'url': record.stripe_checkout_url,
+ }
@property
def stripe_checkout_url(self):
pool = Pool()
database = Transaction().database.name
- Checkout = pool.get('account.payment.stripe.checkout', type='wizard')
- action = Checkout.checkout.get_action()
- return action['url'] % {
+ ModelData = pool.get('ir.model.data')
+ URL = pool.get('ir.action.url')
+ action = URL(ModelData.get_id('account_payment_stripe.url_checkout'))
+ return action.url % {
'http_host': http_host(),
'database': database,
'model': self.__class__.__name__,
@@ -1947,16 +1950,6 @@ class CustomerIdentical(ModelSQL):
where=source.customer != target.customer))
-class Checkout(Wizard):
- __name__ = 'account.payment.stripe.checkout'
- start_state = 'checkout'
- checkout = StateAction('account_payment_stripe.url_checkout')
-
- def do_checkout(self, action):
- action['url'] = self.record.stripe_checkout_url
- return action, {}
-
-
class CheckoutPage(Report):
__name__ = 'account.payment.stripe.checkout'
diff --git a/modules/account_payment_stripe/payment.xml b/modules/account_payment_stripe/payment.xml
index 08fb822a13..0dbc0dcddf 100644
--- a/modules/account_payment_stripe/payment.xml
+++ b/modules/account_payment_stripe/payment.xml
@@ -289,12 +289,6 @@ this repository contains the full copyright notices and license terms. -->
Find Identical
-
- Stripe Checkout
- account.payment.stripe.checkout
-
-
-
Stripe Checkout