[FIX] website_payment: correct compute of providers state

In case stripe provider was deleted, the value of 'stripe' is None. This
will trigger a TypeError using the 'in' operation. We should adapt the
conditional statement to properly do the computation.

closes odoo/odoo#105159

X-original-commit: 12ac629f2989fcf350e9fc69e8ba8e8494f378d9
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
alt-odoo
2022-11-07 14:52:59 +01:00
parent 4cc2b3bcca
commit 83bb71bb16
@@ -38,7 +38,7 @@ class ResConfigSettings(models.TransientModel):
stripe = self.env.ref('payment.payment_provider_stripe', raise_if_not_found=False)
for config in self:
providers = config._get_activated_providers()
first_provider = stripe if stripe in providers else providers[0] if providers else providers
first_provider = stripe if stripe and stripe in providers else providers[0] if providers else providers
config.first_provider_label = _('Configure %s', first_provider.name)
if len(providers) == 1 and providers == paypal:
config.providers_state = 'paypal_only'