From 16c1c89e46946a04499ac483d8546ac4b7d06c35 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 18 Dec 2018 12:45:12 +0000 Subject: [PATCH] [FIX] payment: manual acquirer Raise an error if no manual acquirer could be found for the current company instead of crashing. opw-1915813 opw-1917979 closes odoo/odoo#29608 --- addons/payment/i18n/payment.pot | 6 ++++++ .../payment/wizards/payment_acquirer_onboarding_wizard.py | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/addons/payment/i18n/payment.pot b/addons/payment/i18n/payment.pot index 0e60dda36458c..050e176fe57ae 100644 --- a/addons/payment/i18n/payment.pot +++ b/addons/payment/i18n/payment.pot @@ -1007,6 +1007,12 @@ msgstr "" msgid "Never" msgstr "" +#. module: payment +#: code:addons/payment/wizards/payment_acquirer_onboarding_wizard.py:127 +#, python-format +msgid "No manual payment method could be found for this company. Please create one from the Payment Acquirer menu." +msgstr "" + #. module: payment #: model_terms:ir.ui.view,arch_db:payment.pay msgid "No payment acquirer found." diff --git a/addons/payment/wizards/payment_acquirer_onboarding_wizard.py b/addons/payment/wizards/payment_acquirer_onboarding_wizard.py index 35b0d4b73642c..57f271fdffb9f 100644 --- a/addons/payment/wizards/payment_acquirer_onboarding_wizard.py +++ b/addons/payment/wizards/payment_acquirer_onboarding_wizard.py @@ -123,6 +123,11 @@ def add_payment_methods(self): }) if self.payment_method == 'manual': manual_acquirer = self._get_manual_payment_acquirer(new_env) + if not manual_acquirer: + raise UserError(_( + 'No manual payment method could be found for this company. ' + + 'Please create one from the Payment Acquirer menu.' + )) manual_acquirer.name = self.manual_name manual_acquirer.post_msg = self.manual_post_msg manual_acquirer.website_published = True