Add __href__ and is_secure, host and http_host to url module
This ease the composition of URL pointing to Tryton route. issue8767 review264461005
This commit is contained in:
1 parent
88df004676
commit
5b8f1e4149
2 files changed
+5
-6
No files matched your search
+3
-3
@@ -21,7 +21,7 @@ from trytond.report import Report, get_email
|
||||
from trytond.rpc import RPC
|
||||
from trytond.sendmail import sendmail_transactional
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.url import HOSTNAME
|
||||
from trytond.url import http_host
|
||||
from trytond.wizard import Wizard, StateAction
|
||||
|
||||
from trytond.modules.account_payment.exceptions import (
|
||||
@@ -99,7 +99,7 @@ class CheckoutMixin:
|
||||
Checkout = pool.get('account.payment.stripe.checkout', type='wizard')
|
||||
action = Checkout.checkout.get_action()
|
||||
return action['url'] % {
|
||||
'hostname': HOSTNAME,
|
||||
'http_host': http_host(),
|
||||
'database': database,
|
||||
'model': self.__class__.__name__,
|
||||
'id': self.stripe_checkout_id,
|
||||
@@ -773,7 +773,7 @@ class Account(ModelSQL, ModelView):
|
||||
'identifier': self.webhook_identifier,
|
||||
'database_name': Transaction().database.name,
|
||||
}
|
||||
return 'https://' + HOSTNAME + (
|
||||
return http_host() + (
|
||||
urllib.parse.quote(
|
||||
'/%(database_name)s/account_payment_stripe'
|
||||
'/webhook/%(identifier)s'
|
||||
|
||||
+2
-3
@@ -224,11 +224,10 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="interval_number" eval="15"/>
|
||||
<field name="interval_type">minutes</field>
|
||||
</record>
|
||||
</data>
|
||||
<data noupdate="1">
|
||||
|
||||
<record model="ir.action.url" id="url_checkout">
|
||||
<field name="name">Stripe Checkout</field>
|
||||
<field name="url">https://%(hostname)s:8000/%(database)s/account_payment_stripe/checkout/%(model)s/%(id)s</field>
|
||||
<field name="url">%(http_host)s/%(database)s/account_payment_stripe/checkout/%(model)s/%(id)s</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
Reference in new issue
Block a user