Improve check to return as soon as possible
This commit is contained in:
1 parent
e8b88eb2df
commit
0ec34c9b19
1 file changed
+6
-6
@@ -83,14 +83,14 @@ def check(cursor, user, model, obj_id, transition, signal, context=None):
|
||||
:param transition: a BrowseRecord of workflow.transition
|
||||
:param context: the context
|
||||
'''
|
||||
res = True
|
||||
if transition.signal:
|
||||
res = (signal == transition.signal)
|
||||
if signal != transition.signal:
|
||||
return False
|
||||
|
||||
if transition.group and user != 0:
|
||||
user_obj = Pool(cursor.dbname).get('res.user')
|
||||
user_groups = user_obj.get_groups(cursor, user, context=context)
|
||||
res = res and transition.group.id in user_groups
|
||||
res = res and eval_expr(cursor, user, model, obj_id,
|
||||
transition.condition, context=context)
|
||||
return res
|
||||
if transition.group.id not in user_groups:
|
||||
return False
|
||||
return eval_expr(cursor, user, model, obj_id, transition.condition,
|
||||
context=context)
|
||||
Reference in new issue
Block a user