mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[FIX] use key/value pair for support branding
This commit is contained in:
@@ -2,30 +2,23 @@
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import _, api, models
|
||||
from odoo.exceptions import AccessError, UserError
|
||||
from odoo.exceptions import UserError, AccessError
|
||||
|
||||
|
||||
class ResCompany(models.Model):
|
||||
_inherit = "res.company"
|
||||
|
||||
@api.model
|
||||
def get_ir_config_param_data(self, key):
|
||||
if not self.env.user.has_group("base.group_user"):
|
||||
raise AccessError(
|
||||
_(
|
||||
"You are not allowed to access this "
|
||||
"functionality, please contact Admin for "
|
||||
"more support"
|
||||
)
|
||||
)
|
||||
try:
|
||||
self.env.cr.execute(
|
||||
"select value from ir_config_parameter where " "key=(%s);", (key,)
|
||||
)
|
||||
res = self.env.cr.fetchone()
|
||||
except Exception as e:
|
||||
raise UserError(_("Error: %s" % e))
|
||||
else:
|
||||
if res:
|
||||
return "%s" % res
|
||||
return ""
|
||||
def get_support_branding_config_param_data(self):
|
||||
if not self.env.user.has_group('base.group_user'):
|
||||
raise AccessError(_('You are not allowed to access this '
|
||||
'functionality, please contact Admin for '
|
||||
'more support'))
|
||||
self.env.cr.execute(
|
||||
"select key, value from ir_config_parameter where key ilike "
|
||||
"'%support_%';"
|
||||
)
|
||||
res = self.env.cr.dictfetchall()
|
||||
if any(res):
|
||||
support_vals = {x['key']: x['value'] for x in res}
|
||||
return support_vals
|
||||
|
||||
Reference in New Issue
Block a user