Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
139
Merge Requests
139
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
30d115c8
Commit
30d115c8
authored
Jan 17, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Plain Diff
Some fixes for ERP5 Workflow
See merge request
nexedi/erp5!1532
parents
f844ca79
91af570a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
32 deletions
+33
-32
bt5/erp5_workflow_test/TestTemplateItem/portal_components/test.erp5.testWorkflowAndDCWorkflow.py
.../portal_components/test.erp5.testWorkflowAndDCWorkflow.py
+5
-1
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Workflow_updateSecurityRoles.py
...em/portal_skins/erp5_core/Workflow_updateSecurityRoles.py
+27
-29
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Workflow_updateSecurityRoles.xml
...m/portal_skins/erp5_core/Workflow_updateSecurityRoles.xml
+1
-1
product/ERP5Type/Core/Workflow.py
product/ERP5Type/Core/Workflow.py
+0
-1
No files found.
bt5/erp5_workflow_test/TestTemplateItem/portal_components/test.erp5.testWorkflowAndDCWorkflow.py
View file @
30d115c8
import
urlparse
import
unittest
import
unittest
from
erp5.component.mixin.TestWorkflowMixin
import
TestWorkflowMixin
from
erp5.component.mixin.TestWorkflowMixin
import
TestWorkflowMixin
from
Products.ERP5Type.Core.Workflow
import
ValidationFailed
from
Products.ERP5Type.Core.Workflow
import
ValidationFailed
...
@@ -434,7 +435,10 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
...
@@ -434,7 +435,10 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
modified_role_dict
[
'View'
]
=
(
'Assignee'
,
'Assignor'
,
'Associate'
,
'Auditor'
,
'Author'
,
'Manager'
)
modified_role_dict
[
'View'
]
=
(
'Assignee'
,
'Assignor'
,
'Associate'
,
'Auditor'
,
'Author'
,
'Manager'
)
self
.
workflow
.
state_draft
.
setStatePermissionRoleListDict
(
modified_role_dict
)
self
.
workflow
.
state_draft
.
setStatePermissionRoleListDict
(
modified_role_dict
)
self
.
tic
()
self
.
tic
()
self
.
workflow
.
Workflow_updateSecurityRoles
()
ret
=
self
.
workflow
.
Workflow_updateSecurityRoles
()
self
.
assertEqual
(
urlparse
.
parse_qs
(
urlparse
.
urlparse
(
ret
).
query
)[
'portal_status_message'
],
[
"1 documents updated."
])
self
.
tic
()
self
.
tic
()
self
.
assertEqual
(
text_document
.
_View_Permission
,
(
'Assignee'
,
'Assignor'
,
'Associate'
,
'Auditor'
,
'Author'
,
'Manager'
))
self
.
assertEqual
(
text_document
.
_View_Permission
,
(
'Assignee'
,
'Assignor'
,
'Associate'
,
'Auditor'
,
'Author'
,
'Manager'
))
self
.
workflow
.
state_draft
.
setStatePermissionRoleListDict
(
default_role_dict
)
self
.
workflow
.
state_draft
.
setStatePermissionRoleListDict
(
default_role_dict
)
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Workflow_updateSecurityRoles.py
View file @
30d115c8
"""
Changes permissions of all objects related to this workflow
"""
from
Products.ERP5Type.Message
import
translateString
portal
=
context
.
getPortalObject
()
ACTIVITY_GROUPING_COUNT
=
100
ACTIVITY_GROUPING_COUNT
=
100
def
updateRoleMappings
(
self
,
REQUEST
=
None
):
portal_type_id_list
=
context
.
getPortalTypeListForWorkflow
()
"""
object_list
=
[]
Changes permissions of all objects related to this workflow
if
portal_type_id_list
:
"""
object_list
=
portal
.
portal_catalog
(
portal_type
=
portal_type_id_list
,
limit
=
None
)
portal_type_id_list
=
self
.
getPortalTypeListForWorkflow
()
portal_activities_activate
=
portal
.
portal_activities
.
activate
if
portal_type_id_list
:
object_path_list
=
[
x
.
path
for
x
in
object_list
]
object_list
=
self
.
portal_catalog
(
portal_type
=
portal_type_id_list
,
limit
=
None
)
for
i
in
xrange
(
0
,
len
(
object_list
),
ACTIVITY_GROUPING_COUNT
):
portal_activities
=
self
.
portal_activities
current_path_list
=
object_path_list
[
i
:
i
+
ACTIVITY_GROUPING_COUNT
]
object_path_list
=
[
x
.
path
for
x
in
object_list
]
portal_activities_activate
(
for
i
in
xrange
(
0
,
len
(
object_list
),
ACTIVITY_GROUPING_COUNT
):
activity
=
'SQLQueue'
,
current_path_list
=
object_path_list
[
i
:
i
+
ACTIVITY_GROUPING_COUNT
]
priority
=
3
,
portal_activities
.
activate
(
activity
=
'SQLQueue'
,
).
callMethodOnObjectList
(
priority
=
3
)
\
current_path_list
,
.
callMethodOnObjectList
(
current_path_list
,
'updateRoleMappingsFor'
,
'updateRoleMappingsFor'
,
wf_id
=
context
.
getId
(),
wf_id
=
self
.
getId
())
)
else
:
message
=
translateString
(
'No document updated.'
)
object_list
=
[]
if
object_list
:
if
REQUEST
is
not
None
:
message
=
translateString
(
message
=
'No object updated.'
'${document_count} documents updated.'
,
if
object_list
:
mapping
=
{
'document_count'
:
len
(
object_list
)},
message
=
'%d object(s) updated:
\
n
%s.'
%
(
len
(
object_list
),
)
', '
.
join
([
o
.
getTitleOrId
()
+
' ('
+
o
.
getPortalType
()
+
')'
for
o
in
object_list
]))
return
message
else
:
return
len
(
object_list
)
message
=
updateRoleMappings
(
context
,
context
.
REQUEST
)
return
context
.
Base_redirect
(
form_id
,
keep_items
=
{
'portal_status_message'
:
message
})
return
context
.
Base_redirect
(
form_id
,
keep_items
=
{
'portal_status_message'
:
message
})
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Workflow_updateSecurityRoles.xml
View file @
30d115c8
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
form_id=None
</string>
</value>
<value>
<string>
form_id=None
, **kw
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
product/ERP5Type/Core/Workflow.py
View file @
30d115c8
...
@@ -834,7 +834,6 @@ class Workflow(XMLObject):
...
@@ -834,7 +834,6 @@ class Workflow(XMLObject):
if
object_context
is
None
:
if
object_context
is
None
:
# XXX(WORKFLOW): investigate: should I keep source value here, or can I use old_state (see test results also)
# XXX(WORKFLOW): investigate: should I keep source value here, or can I use old_state (see test results also)
object_context
=
self
.
getStateChangeInformation
(
ob
,
self
.
getSourceValue
())
object_context
=
self
.
getStateChangeInformation
(
ob
,
self
.
getSourceValue
())
object_context
.
REQUEST
.
other
.
update
(
kwargs
)
for
vdef
in
self
.
getVariableValueList
():
for
vdef
in
self
.
getVariableValueList
():
variable_id
=
vdef
.
getId
()
variable_id
=
vdef
.
getId
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment