From a6cd96c5c5dd4e1f2b949bc5c5e87e8217feea16 Mon Sep 17 00:00:00 2001 From: Valentin Chevalier Date: Thu, 15 Sep 2022 12:50:21 +0000 Subject: [PATCH] [IMP] (account_)payment, sale: add docstrings Add docstrings to clarify methods in the payment link wizard. closes odoo/odoo#100186 Signed-off-by: Antoine Vandevenne (anv) --- addons/account_payment/wizards/payment_link_wizard.py | 9 +++++++++ addons/payment/wizards/payment_link_wizard.py | 7 +++++++ addons/sale/wizard/payment_link_wizard.py | 9 +++++++++ 3 files changed, 25 insertions(+) diff --git a/addons/account_payment/wizards/payment_link_wizard.py b/addons/account_payment/wizards/payment_link_wizard.py index b7fa42c3347..bcf1129b554 100644 --- a/addons/account_payment/wizards/payment_link_wizard.py +++ b/addons/account_payment/wizards/payment_link_wizard.py @@ -7,6 +7,15 @@ class PaymentLinkWizard(models.TransientModel): _inherit = 'payment.link.wizard' def _get_additional_link_values(self): + """ Override of `payment` to add `invoice_id` to the payment link values. + + The other values related to the invoice are directly read from the invoice. + + Note: self.ensure_one() + + :return: The additional payment link values. + :rtype: dict + """ res = super()._get_additional_link_values() if self.res_model != 'account.move': return res diff --git a/addons/payment/wizards/payment_link_wizard.py b/addons/payment/wizards/payment_link_wizard.py index b461282aa4e..e122b900560 100644 --- a/addons/payment/wizards/payment_link_wizard.py +++ b/addons/payment/wizards/payment_link_wizard.py @@ -145,6 +145,13 @@ class PaymentLinkWizard(models.TransientModel): payment_link.link = f'{base_url}/payment/pay?{urls.url_encode(url_params)}' def _get_additional_link_values(self): + """ Return the additional values to append to the payment link. + + Note: self.ensure_one() + + :return: The additional payment link values. + :rtype: dict + """ self.ensure_one() return { 'currency_id': self.currency_id.id, diff --git a/addons/sale/wizard/payment_link_wizard.py b/addons/sale/wizard/payment_link_wizard.py index ed5e7895506..b358943d9dc 100644 --- a/addons/sale/wizard/payment_link_wizard.py +++ b/addons/sale/wizard/payment_link_wizard.py @@ -23,6 +23,15 @@ class PaymentLinkWizard(models.TransientModel): return super()._get_payment_provider_available(**kwargs) def _get_additional_link_values(self): + """ Override of `payment` to add `sale_order_id` to the payment link values. + + The other values related to the sales order are directly read from the sales order. + + Note: self.ensure_one() + + :return: The additional payment link values. + :rtype: dict + """ res = super()._get_additional_link_values() if self.res_model != 'sale.order': return res