From fa3c04e5fe8e968422a770ca5dcffadeb57cab3f Mon Sep 17 00:00:00 2001 From: Benoit Socias Date: Fri, 3 Sep 2021 07:42:40 +0000 Subject: [PATCH] [FIX] website_payment: obtain country and currency in donation form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit country and currency were not correctly populated in the donation form. After this commit country of a logged in user is correctly pre-populated and donations can be done in the current currency of the user. task-2398403 closes odoo/odoo#75921 Signed-off-by: Jérémy Kersten (jke) --- addons/website_payment/controllers/portal.py | 2 +- addons/website_payment/views/donation_templates.xml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/website_payment/controllers/portal.py b/addons/website_payment/controllers/portal.py index 095382145b7..7fb50e15725 100644 --- a/addons/website_payment/controllers/portal.py +++ b/addons/website_payment/controllers/portal.py @@ -23,7 +23,7 @@ class PaymentPortal(payment_portal.PaymentPortal): :raise: werkzeug.exceptions.NotFound if the access token is invalid """ kwargs['is_donation'] = True - kwargs['currency_id'] = int(kwargs.get('currency', request.env.company.currency_id.id)) + kwargs['currency_id'] = int(kwargs.get('currency_id', request.env.company.currency_id.id)) kwargs['amount'] = float(kwargs.get('amount', 25)) kwargs['donation_options'] = kwargs.get('donation_options', json_safe.dumps(dict(customAmount="freeAmount"))) diff --git a/addons/website_payment/views/donation_templates.xml b/addons/website_payment/views/donation_templates.xml index b5a44bbdcf2..494fe0dc5f5 100644 --- a/addons/website_payment/views/donation_templates.xml +++ b/addons/website_payment/views/donation_templates.xml @@ -22,15 +22,15 @@ - +
- -