Files
odoo_source/addons/website_payment_paypal/models/res_config_settings.py
T
niyasraphy 2774e276ac [FIX] website_payment_paypal: trace back accessing settings after deleting paypal
traceback is raised in settings page and on clicking activate stripe button after deleting the paypal payment provider from the database

closes odoo/odoo#105692

X-original-commit: 4d34606baf314c78d608904720778ff2ac6bf5b4
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2022-11-18 12:57:52 +01:00

25 lines
858 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
paypal_email_account = fields.Char()
@api.model
def get_values(self):
res = super().get_values()
paypal = self.env.ref('payment.payment_provider_paypal', raise_if_not_found=False)
if paypal:
res['paypal_email_account'] = paypal.sudo().paypal_email_account
return res
def set_values(self):
super().set_values()
paypal = self.env.ref('payment.payment_provider_paypal', raise_if_not_found=False)
if paypal and paypal.sudo().paypal_email_account != self.paypal_email_account:
paypal.sudo().paypal_email_account = self.paypal_email_account