Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ai_oca_bridge_extra_parameters/models/ai_extra_parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class AIExtraParameter(models.Model):
"sorted",
"enumerate",
"range",
"env",
}

ALLOWED_FORMULA_CONTEXT_VARS = {
Expand Down Expand Up @@ -117,6 +118,7 @@ class AIExtraParameter(models.Model):
"KeyError",
"IndexError",
"ZeroDivisionError",
"env",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not actually, you enabled it here. It was removed for a reason....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There I'm allowing env itself, but object.env was usable before. I have several extra parameters using object.env and they work fine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, yes, sorry, see my latest comment. I made a technical review of the module and you comments are true

}

@staticmethod
Expand Down Expand Up @@ -248,6 +250,7 @@ def evaluate_single_expression(match):
"True": True,
"False": False,
"None": None,
"env": self.env,
}

try:
Expand Down Expand Up @@ -315,6 +318,7 @@ def _evaluate_formula(self, obj=None):
"True": True,
"False": False,
"None": None,
"env": self.env,
}

try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ def test_invalid_variable_names(self):
"{partner.name}",
"{obj.name}",
"{user.name}",
"{env}",
"{cr}",
]

Expand Down