misc: add backward-compatibility support for role id as integer (#57131)

This commit is contained in:
Frédéric Péters 2021-09-21 10:05:39 +02:00
parent 73630363dc
commit 6b310b6ec4
1 changed files with 3 additions and 2 deletions

View File

@ -287,9 +287,10 @@ class FormDefUI:
if filled.workflow_roles:
workflow_roles.update(filled.workflow_roles)
for function_key, function_value in workflow_roles.items():
if isinstance(function_value, str):
if isinstance(function_value, (str, int)):
# single role, defined at formdef level
function_values = {function_value}
# (int are for compatibility with very old forms)
function_values = {str(function_value)}
else:
# list of roles (or none), defined at formdata level
function_values = set(function_value or [])