Skip to content
Snippets Groups Projects
Commit d3acafe3e8fa authored by oury.balde's avatar oury.balde
Browse files

Refactor 'force_code_id' logic to handle context key and return force_code

Updated logic for handling 'force_code_id' in `MetaAnalytic` class
parent 229f5119eddc
No related branches found
1 merge request!35Refactor 'force_code_id' logic to handle context key and return force_code
Pipeline #86107 passed
......@@ -502,9 +502,11 @@
# Direct changes to the 'bound analytic code' field are ignored
# unless the 'force_code_id' context key is passed as True.
force_code_id = vals.pop(column, False)
if self.env.context.get("force_code_id"):
self._force_code(force_code_id, code_vals)
force_code_id = vals.pop(column, False) or self.env.context.get(
"force_code_id"
)
if force_code_id:
new_code = self._force_code(force_code_id, code_vals)
vals[column] = force_code_id
else:
......@@ -577,8 +579,10 @@
# Direct changes to the 'bound analytic code' field are ignored
# unless the 'force_code_id' context key is passed as True.
force_code_id = vals.pop(column, False)
if self.env.context.get("force_code_id"):
force_code_id = vals.pop(column, False) or self.env.context.get(
"force_code_id"
)
if force_code_id:
self._force_code(force_code_id, code_vals)
vals[column] = force_code_id
......@@ -677,6 +681,7 @@
if code_vals:
# These are behind-the-scenes links so bypass security rules.
force_code.sudo().write(code_vals)
return force_code
if sync_parent:
# This function is called as a method and can be overridden.
......
......@@ -2,6 +2,11 @@
Changes
=======
16.0.1.3.3
----------
Refactor "force_code_id" logic to handle context key and return _force_code.
16.0.1.3.2
----------
......
......@@ -21,7 +21,7 @@
"name": "Analytic Structure",
"license": "AGPL-3",
"summary": "Dynamic relationships between objects to build analytic matrices.",
"version": "16.0.1.3.2",
"version": "16.0.1.3.3",
"author": "XCG Consulting",
"category": "Hidden",
"website": "https://orbeet.io",
......
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