[FIX] base: fix local variable 'res' referenced before assignment
In the loop `for action in self`, if all iterations
passed in the first `if` block only, res
was never assigned, but returned.
This is an oversight during the conversion of the module to the new API
in revision eb04aa1e39
One could ask himself why `res = False` is before the loop
and not in this `if` block, but we believe this is
in the case multiple actions are passed to this method,
you wouldn't like the result of the first actions in the loop
to be overwritten by `False` when the condition of the last
action of the loop is not met.
For instance the first action returns as result an action but for the
second, the condition to run it is not met, in such a case
you would like what the first action returned as action.
opw-706150
This commit is contained in:
@@ -948,6 +948,7 @@ class IrActionsServer(models.Model):
|
||||
:return: an action_id to be executed, or False is finished correctly without
|
||||
return action
|
||||
"""
|
||||
res = False
|
||||
for action in self:
|
||||
eval_context = self._get_eval_context(action)
|
||||
condition = action.condition
|
||||
|
||||
Reference in New Issue
Block a user