From 36cf1708a4be78eb629746a593bcf04813be86b3 Mon Sep 17 00:00:00 2001 From: niyasraphy Date: Mon, 4 Sep 2023 11:43:48 +0300 Subject: [PATCH] [FIX] (account,website)_payment, sale: pass argument values in super call before this commit, on inheriting the function _get_custom_rendering_context_values the argument values are not received in the inherited function as it is not passed along with the super scenario: * consider that the payment link is shared to customer * customer made the full payment * once the sale or invoice is fully paid, the link has to be shown as fully paid or expired * for doing this, if we inherit the above function, the arguments is not passed to the function after this commit, the argument values are passed to super and the value can be used re used in the further inherit of this function closes odoo/odoo#134195 X-original-commit: 49b91e47c6c24e0023110365e7f9084a2c13ca5a Signed-off-by: Antoine Vandevenne (anv) --- addons/account_payment/controllers/payment.py | 4 +++- addons/sale/controllers/portal.py | 4 +++- addons/website_payment/controllers/portal.py | 11 +++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/addons/account_payment/controllers/payment.py b/addons/account_payment/controllers/payment.py index a0f95f4f8ff..279c0c9504a 100644 --- a/addons/account_payment/controllers/payment.py +++ b/addons/account_payment/controllers/payment.py @@ -88,7 +88,9 @@ class PaymentPortal(payment_portal.PaymentPortal): :return: The extended rendering context values. :rtype: dict """ - rendering_context_values = super()._get_custom_rendering_context_values(**kwargs) + rendering_context_values = super()._get_custom_rendering_context_values( + invoice_id=invoice_id, **kwargs + ) if invoice_id: rendering_context_values['invoice_id'] = invoice_id diff --git a/addons/sale/controllers/portal.py b/addons/sale/controllers/portal.py index f0c19049770..483eea6aefd 100644 --- a/addons/sale/controllers/portal.py +++ b/addons/sale/controllers/portal.py @@ -378,7 +378,9 @@ class PaymentPortal(payment_portal.PaymentPortal): :return: The extended rendering context values :rtype: dict """ - rendering_context_values = super()._get_custom_rendering_context_values(**kwargs) + rendering_context_values = super()._get_custom_rendering_context_values( + sale_order_id=sale_order_id, **kwargs + ) if sale_order_id: rendering_context_values['sale_order_id'] = sale_order_id diff --git a/addons/website_payment/controllers/portal.py b/addons/website_payment/controllers/portal.py index f83d37f716f..d70090d64c4 100644 --- a/addons/website_payment/controllers/portal.py +++ b/addons/website_payment/controllers/portal.py @@ -84,8 +84,15 @@ class PaymentPortal(payment_portal.PaymentPortal): return tx_sudo._get_processing_values() - def _get_custom_rendering_context_values(self, donation_options=None, donation_descriptions=None, is_donation=False, **kwargs): - rendering_context = super()._get_custom_rendering_context_values(**kwargs) + def _get_custom_rendering_context_values( + self, donation_options=None, donation_descriptions=None, is_donation=False, **kwargs + ): + rendering_context = super()._get_custom_rendering_context_values( + donation_options=donation_options, + donation_descriptions=donation_descriptions, + is_donation=is_donation, + **kwargs, + ) if is_donation: user_sudo = request.env.user logged_in = not user_sudo._is_public()