diff --git a/addons/account_payment/controllers/portal.py b/addons/account_payment/controllers/portal.py index df0aae049e1..3903fbfb4b3 100644 --- a/addons/account_payment/controllers/portal.py +++ b/addons/account_payment/controllers/portal.py @@ -20,7 +20,7 @@ class PortalAccount(portal.PortalAccount): # Make sure that the partner's company matches the invoice's company. invoice_company = invoice.company_id or request.env.company - PaymentPortal.ensure_matching_companies(partner, invoice_company) + PaymentPortal._ensure_matching_companies(partner, invoice_company) acquirers_sudo = request.env['payment.acquirer'].sudo()._get_compatible_acquirers( invoice_company.id, partner.id, currency_id=invoice.currency_id.id diff --git a/addons/payment/controllers/portal.py b/addons/payment/controllers/portal.py index c2b156414a9..ab6b9dcfd04 100644 --- a/addons/payment/controllers/portal.py +++ b/addons/payment/controllers/portal.py @@ -68,9 +68,9 @@ class PaymentPortal(portal.CustomerPortal): """ # Cast numeric parameters as int or float and void them if their str value is malformed currency_id, acquirer_id, partner_id, company_id, invoice_id = tuple(map( - self.cast_as_int, (currency_id, acquirer_id, partner_id, company_id, invoice_id) + self._cast_as_int, (currency_id, acquirer_id, partner_id, company_id, invoice_id) )) - amount = self.cast_as_float(amount) + amount = self._cast_as_float(amount) # Raise an HTTP 404 if a partner is provided with an invalid access token if partner_id: @@ -104,7 +104,7 @@ class PaymentPortal(portal.CustomerPortal): currency_id = currency_id or company.currency_id.id # Make sure that the company passed as parameter matches the partner's company. - PaymentPortal.ensure_matching_companies(partner_sudo, company) + PaymentPortal._ensure_matching_companies(partner_sudo, company) # Make sure that the currency exists and is active currency = request.env['res.currency'].browse(currency_id).exists() @@ -346,7 +346,7 @@ class PaymentPortal(portal.CustomerPortal): :param dict kwargs: Optional data. This parameter is not used here :raise: werkzeug.exceptions.NotFound if the access token is invalid """ - tx_id = self.cast_as_int(tx_id) + tx_id = self._cast_as_int(tx_id) if tx_id: tx_sudo = request.env['payment.transaction'].sudo().browse(tx_id) @@ -404,7 +404,7 @@ class PaymentPortal(portal.CustomerPortal): token_sudo.active = False @staticmethod - def cast_as_int(str_value): + def _cast_as_int(str_value): """ Cast a string as an `int` and return it. If the conversion fails, `None` is returned instead. @@ -419,7 +419,7 @@ class PaymentPortal(portal.CustomerPortal): return None @staticmethod - def cast_as_float(str_value): + def _cast_as_float(str_value): """ Cast a string as a `float` and return it. If the conversion fails, `None` is returned instead. @@ -434,7 +434,7 @@ class PaymentPortal(portal.CustomerPortal): return None @staticmethod - def ensure_matching_companies(partner, document_company): + def _ensure_matching_companies(partner, document_company): """ Check that the partner's company is the same as the document's company. If the partner company is not set, the check passes. If the companies don't match, a diff --git a/addons/sale/controllers/portal.py b/addons/sale/controllers/portal.py index 92b38d3067f..41c68bf65f2 100644 --- a/addons/sale/controllers/portal.py +++ b/addons/sale/controllers/portal.py @@ -154,7 +154,7 @@ class CustomerPortal(portal.CustomerPortal): logged_in = not request.env.user._is_public() # Make sure that the partner's company matches the sales order's company. - payment_portal.PaymentPortal.ensure_matching_companies( + payment_portal.PaymentPortal._ensure_matching_companies( order_sudo.partner_id, order_sudo.company_id ) @@ -321,8 +321,8 @@ class PaymentPortal(payment_portal.PaymentPortal): :raise: ValidationError if the order id is invalid """ # Cast numeric parameters as int or float and void them if their str value is malformed - amount = self.cast_as_float(amount) - sale_order_id = self.cast_as_int(sale_order_id) + amount = self._cast_as_float(amount) + sale_order_id = self._cast_as_int(sale_order_id) if sale_order_id: order_sudo = request.env['sale.order'].sudo().browse(sale_order_id).exists() if not order_sudo: