From 66f204ecd3fc3e73e1572ee0cd7a2ec14550adf6 Mon Sep 17 00:00:00 2001 From: "Antoine Vandevenne (anv)" Date: Fri, 1 Jul 2022 16:42:01 +0000 Subject: [PATCH] [PRF] payment_adyen: only load the SDK on pages with a payment form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The SDK of Adyen Checkout is quite large (≲ 1MB) and was always loaded on all frontend pages before this commit, which hurt the loading performances. This commit restricts the loading of the SDK to pages that include one of the payment forms (either 'checkout' or 'manage'). task-2899271 closes odoo/odoo#95121 Signed-off-by: Antoine Vandevenne (anv) --- addons/payment_adyen/__manifest__.py | 3 +- .../payment_adyen/views/payment_templates.xml | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 addons/payment_adyen/views/payment_templates.xml diff --git a/addons/payment_adyen/__manifest__.py b/addons/payment_adyen/__manifest__.py index cd8449513f6..daea33f3801 100644 --- a/addons/payment_adyen/__manifest__.py +++ b/addons/payment_adyen/__manifest__.py @@ -11,14 +11,13 @@ 'data': [ 'views/payment_adyen_templates.xml', 'views/payment_views.xml', + 'views/payment_templates.xml', # Only load the SDK on pages with a payment form. 'data/payment_acquirer_data.xml', # Depends on views/payment_adyen_templates.xml ], 'application': True, 'uninstall_hook': 'uninstall_hook', 'assets': { 'web.assets_frontend': [ - 'https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/4.7.3/adyen.css', - 'https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/4.7.3/adyen.js', 'payment_adyen/static/src/js/payment_form.js', 'payment_adyen/static/src/scss/dropin.scss', ], diff --git a/addons/payment_adyen/views/payment_templates.xml b/addons/payment_adyen/views/payment_templates.xml new file mode 100644 index 00000000000..af5f39d841b --- /dev/null +++ b/addons/payment_adyen/views/payment_templates.xml @@ -0,0 +1,28 @@ + + + + + + + + + +