Skip to content

Commit 95d0cff

Browse files
committed
[FIX] server_environment_ir_config_parameter: Don't save values in DB
1 parent 03d8a03 commit 95d0cff

File tree

1 file changed

+1
-36
lines changed

1 file changed

+1
-36
lines changed

server_environment_ir_config_parameter/models/ir_config_parameter.py

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -34,42 +34,7 @@ def get_param(self, key, default=False):
3434
_("Key %s is empty in " "server_environment_file") % (key,)
3535
)
3636
if cvalue != value:
37-
# we write in db on first access;
38-
# should we have preloaded values in database at,
39-
# server startup, modules loading their parameters
40-
# from data files would break on unique key error.
41-
if not self.env.context.get("_from_get_param", 0):
42-
# the check is to avoid recursion, for instance the mail
43-
# addon has an override in ir.config_parameter::write which
44-
# calls get_param if we are setting mail.catchall.alias and
45-
# this will cause an infinite recursion. We cut that
46-
# recursion by using the context check.
47-
#
48-
# The mail addon call to get_param expects to get the value
49-
# *before* the change, so we have to return the database
50-
# value in that case
51-
self.sudo().with_context(_from_get_param=1).set_param(key, cvalue)
52-
value = cvalue
37+
value = cvalue
5338
if value is None:
5439
return default
5540
return value
56-
57-
@api.model_create_multi
58-
def create(self, vals_list):
59-
for vals in vals_list:
60-
key = vals.get("key")
61-
if key and serv_config.has_option(SECTION, key):
62-
# enforce value from config file
63-
vals.update(value=serv_config.get(SECTION, key))
64-
return super().create(vals_list)
65-
66-
def write(self, vals):
67-
for rec in self:
68-
key = vals.get("key", rec.key)
69-
if serv_config.has_option(SECTION, key):
70-
# enforce value from config file
71-
newvals = dict(vals, value=serv_config.get(SECTION, key))
72-
else:
73-
newvals = vals
74-
super(IrConfigParameter, rec).write(newvals)
75-
return True

0 commit comments

Comments
 (0)