Skip to content
Snippets Groups Projects
Commit 701c1b30 authored by Houzefa Abbasbhay's avatar Houzefa Abbasbhay :slight_smile:
Browse files

Bound analytic codes: Bypass security rules

Behind-the-scenes objects; main object security rules are enough.
parent 92102b65
No related branches found
No related tags found
No related merge requests found
...@@ -444,7 +444,8 @@ ...@@ -444,7 +444,8 @@
# inherits. # inherits.
code_obj = self.env["analytic.code"] code_obj = self.env["analytic.code"]
code_vals["nd_id"] = self._get_bound_dimension_id() code_vals["nd_id"] = self._get_bound_dimension_id()
code = code_obj.create(code_vals) # These are behind-the-scenes links so bypass security rules.
code = code_obj.sudo().create(code_vals)
vals[column] = code.id vals[column] = code.id
new_code = code new_code = code
...@@ -502,7 +503,8 @@ ...@@ -502,7 +503,8 @@
self._generate_code_ref_id(res) self._generate_code_ref_id(res)
if new_code: if new_code:
new_code.write( # These are behind-the-scenes links so bypass security rules.
new_code.sudo().write(
{"origin_id": "{},{}".format(self._name, res.id)} {"origin_id": "{},{}".format(self._name, res.id)}
) )
...@@ -581,8 +583,12 @@ ...@@ -581,8 +583,12 @@
rec_code_vals["origin_id"] = "{},{}".format( rec_code_vals["origin_id"] = "{},{}".format(
self._name, rec.id self._name, rec.id
) )
rec_vals[column] = code_obj.create(rec_code_vals).id # These are behind-the-scenes links so bypass security
# rules.
rec_vals[column] = (
code_obj.sudo().create(rec_code_vals).id
)
super(superclass, rec).write(rec_vals, **kwargs) super(superclass, rec).write(rec_vals, **kwargs)
elif rec_code_vals: elif rec_code_vals:
...@@ -585,8 +591,10 @@ ...@@ -585,8 +591,10 @@
super(superclass, rec).write(rec_vals, **kwargs) super(superclass, rec).write(rec_vals, **kwargs)
elif rec_code_vals: elif rec_code_vals:
code.write(rec_code_vals) # These are behind-the-scenes links so bypass security
# rules.
code.sudo().write(rec_code_vals)
if code_ref_ids and news is not False: if code_ref_ids and news is not False:
for new in news: for new in news:
...@@ -611,7 +619,8 @@ ...@@ -611,7 +619,8 @@
res = super(superclass, self).unlink() res = super(superclass, self).unlink()
codes.unlink(**kwargs) # These are behind-the-scenes links so bypass security rules.
codes.sudo().unlink(**kwargs)
return res return res
...@@ -633,7 +642,8 @@ ...@@ -633,7 +642,8 @@
"analytic dimension {}".format(dimension_name) "analytic dimension {}".format(dimension_name)
) )
if code_vals: if code_vals:
force_code.write(code_vals) # These are behind-the-scenes links so bypass security rules.
force_code.sudo().write(code_vals)
if sync_parent: if sync_parent:
# This function is called as a method and can be overridden. # This function is called as a method and can be overridden.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment