changeset 704a75e6416e in modules/account_payment_stripe:default
details: 
https://hg.tryton.org/modules/account_payment_stripe?cmd=changeset;node=704a75e6416e
description:
        Add __href__ and is_secure, host and http_host to url module

        This ease the composition of URL pointing to Tryton route.

        issue8767
        review264461005
diffstat:

 payment.py  |  6 +++---
 payment.xml |  5 ++---
 2 files changed, 5 insertions(+), 6 deletions(-)

diffs (47 lines):

diff -r 994555c85dab -r 704a75e6416e payment.py
--- a/payment.py        Mon Nov 25 21:55:20 2019 +0100
+++ b/payment.py        Tue Nov 26 22:16:00 2019 +0100
@@ -21,7 +21,7 @@
 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 @@
         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 @@
             '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'
diff -r 994555c85dab -r 704a75e6416e payment.xml
--- a/payment.xml       Mon Nov 25 21:55:20 2019 +0100
+++ b/payment.xml       Tue Nov 26 22:16:00 2019 +0100
@@ -224,11 +224,10 @@
             <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>

Reply via email to