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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
erp5
Commits
08867eee
Commit
08867eee
authored
Feb 10, 2017
by
iv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Workflow: always sort workflow list associated to portal types
parent
25e5288f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
10 deletions
+17
-10
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+7
-7
product/ERP5/tests/testBusinessTemplate.py
product/ERP5/tests/testBusinessTemplate.py
+2
-2
product/ERP5Type/ERP5Type.py
product/ERP5Type/ERP5Type.py
+8
-1
No files found.
product/ERP5/Document/BusinessTemplate.py
View file @
08867eee
...
@@ -1406,7 +1406,7 @@ class ObjectTemplateItem(BaseTemplateItem):
...
@@ -1406,7 +1406,7 @@ class ObjectTemplateItem(BaseTemplateItem):
if
portal_type_dict
:
if
portal_type_dict
:
# set workflow chain
# set workflow chain
workflow_list
=
portal_type_dict
.
pop
(
'workflow_chain'
)
workflow_list
=
portal_type_dict
.
pop
(
'workflow_chain'
)
obj
.
setTypeWorkflowList
(
sorted
(
workflow_list
)
)
obj
.
setTypeWorkflowList
(
workflow_list
)
# restore some other properties
# restore some other properties
obj
.
__dict__
.
update
(
portal_type_dict
)
obj
.
__dict__
.
update
(
portal_type_dict
)
# import sub objects if there is
# import sub objects if there is
...
@@ -2299,7 +2299,7 @@ class WorkflowTemplateItem(ObjectTemplateItem):
...
@@ -2299,7 +2299,7 @@ class WorkflowTemplateItem(ObjectTemplateItem):
for
portal_type
in
types_tool
.
listTypeInfo
():
for
portal_type
in
types_tool
.
listTypeInfo
():
workflow_set
=
set
(
portal_type
.
getTypeWorkflowList
())
-
\
workflow_set
=
set
(
portal_type
.
getTypeWorkflowList
())
-
\
removed_workflow_id_list
removed_workflow_id_list
portal_type
.
setTypeWorkflowList
(
sorted
(
workflow_set
)
)
portal_type
.
setTypeWorkflowList
(
workflow_set
)
ObjectTemplateItem
.
uninstall
(
self
,
context
,
**
kw
)
ObjectTemplateItem
.
uninstall
(
self
,
context
,
**
kw
)
class
PortalTypeTemplateItem
(
ObjectTemplateItem
):
class
PortalTypeTemplateItem
(
ObjectTemplateItem
):
...
@@ -2377,11 +2377,11 @@ class PortalTypeTemplateItem(ObjectTemplateItem):
...
@@ -2377,11 +2377,11 @@ class PortalTypeTemplateItem(ObjectTemplateItem):
continue
continue
portal_type
=
obj
.
id
portal_type
=
obj
.
id
if
self
.
_workflow_chain_archive
.
has_key
(
portal_type
):
if
self
.
_workflow_chain_archive
.
has_key
(
portal_type
):
obj
.
setTypeWorkflowList
(
sorted
(
[
obj
.
setTypeWorkflowList
([
w
.
strip
()
for
w
in
w
.
strip
()
for
w
in
self
.
_workflow_chain_archive
[
portal_type
].
split
(
','
)
self
.
_workflow_chain_archive
[
portal_type
].
split
(
','
)
if
w
.
strip
()
not
in
(
''
,
'(Default)'
)
if
w
.
strip
()
not
in
(
''
,
'(Default)'
)
])
)
])
# XXX : this method is kept temporarily, but can be removed once all bt5 are
# XXX : this method is kept temporarily, but can be removed once all bt5 are
# re-exported with separated workflow-chain information
# re-exported with separated workflow-chain information
def
_importFile
(
self
,
file_name
,
file
):
def
_importFile
(
self
,
file_name
,
file
):
...
@@ -2533,7 +2533,7 @@ class PortalTypeWorkflowChainTemplateItem(BaseTemplateItem):
...
@@ -2533,7 +2533,7 @@ class PortalTypeWorkflowChainTemplateItem(BaseTemplateItem):
workflow_id_set
.
add
(
wf_id
)
workflow_id_set
.
add
(
wf_id
)
changed
=
not
(
workflow_id_set
==
old_workflow_id_set
)
changed
=
not
(
workflow_id_set
==
old_workflow_id_set
)
type_object
.
setTypeWorkflowList
(
sorted
(
workflow_id_set
)
)
type_object
.
setTypeWorkflowList
(
workflow_id_set
)
if
not
workflow_id_list
:
if
not
workflow_id_list
:
# Check if it has normally to remove a workflow chain, in order to
# Check if it has normally to remove a workflow chain, in order to
...
@@ -2543,7 +2543,7 @@ class PortalTypeWorkflowChainTemplateItem(BaseTemplateItem):
...
@@ -2543,7 +2543,7 @@ class PortalTypeWorkflowChainTemplateItem(BaseTemplateItem):
raise
ValueError
,
'"%s" is not a workflow ID for %s'
%
\
raise
ValueError
,
'"%s" is not a workflow ID for %s'
%
\
(
wf_id
,
portal_type
)
(
wf_id
,
portal_type
)
changed
=
not
(
workflow_id_set
==
old_workflow_id_set
)
changed
=
not
(
workflow_id_set
==
old_workflow_id_set
)
type_object
.
setTypeWorkflowList
(
sorted
(
workflow_id_set
)
)
type_object
.
setTypeWorkflowList
(
workflow_id_set
)
else
:
else
:
raise
ValueError
(
'Cannot chain workflow %r to non existing '
raise
ValueError
(
'Cannot chain workflow %r to non existing '
'portal type %r'
%
(
self
.
_chain_string_separator
\
'portal type %r'
%
(
self
.
_chain_string_separator
\
...
@@ -2571,7 +2571,7 @@ class PortalTypeWorkflowChainTemplateItem(BaseTemplateItem):
...
@@ -2571,7 +2571,7 @@ class PortalTypeWorkflowChainTemplateItem(BaseTemplateItem):
old_workflow_id_list
=
type_object
.
getTypeWorkflowList
()
old_workflow_id_list
=
type_object
.
getTypeWorkflowList
()
workflow_id_list
=
[
workflow_id
for
workflow_id
in
old_workflow_id_list
workflow_id_list
=
[
workflow_id
for
workflow_id
in
old_workflow_id_list
if
workflow_id
not
in
removed_workflow_id_list
]
if
workflow_id
not
in
removed_workflow_id_list
]
type_object
.
setTypeWorkflowList
(
sorted
(
workflow_id_list
)
)
type_object
.
setTypeWorkflowList
(
workflow_id_list
)
def
preinstall
(
self
,
context
,
installed_item
,
**
kw
):
def
preinstall
(
self
,
context
,
installed_item
,
**
kw
):
modified_object_list
=
{}
modified_object_list
=
{}
...
...
product/ERP5/tests/testBusinessTemplate.py
View file @
08867eee
...
@@ -139,7 +139,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -139,7 +139,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
workflow_list
=
type_object
.
getTypeWorkflowList
()
workflow_list
=
type_object
.
getTypeWorkflowList
()
if
'geek_workflow'
in
workflow_list
:
if
'geek_workflow'
in
workflow_list
:
workflow_set
=
set
(
workflow_list
)
-
{
'geek_workflow'
}
workflow_set
=
set
(
workflow_list
)
-
{
'geek_workflow'
}
type_object
.
setTypeWorkflowList
(
sorted
(
workflow_set
)
)
type_object
.
setTypeWorkflowList
(
workflow_set
)
if
'erp5_geek'
in
self
.
getSkinsTool
().
objectIds
():
if
'erp5_geek'
in
self
.
getSkinsTool
().
objectIds
():
self
.
getSkinsTool
().
manage_delObjects
([
'erp5_geek'
])
self
.
getSkinsTool
().
manage_delObjects
([
'erp5_geek'
])
...
@@ -1407,7 +1407,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
...
@@ -1407,7 +1407,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
workflow_list
=
type_object
.
getTypeWorkflowList
()
workflow_list
=
type_object
.
getTypeWorkflowList
()
if
wf_id
in
workflow_list
:
if
wf_id
in
workflow_list
:
workflow_set
=
set
(
workflow_list
)
-
{
wf_id
}
workflow_set
=
set
(
workflow_list
)
-
{
wf_id
}
type_object
.
setTypeWorkflowList
(
sorted
(
workflow_set
)
)
type_object
.
setTypeWorkflowList
(
workflow_set
)
def
stepCheckWorkflowExists
(
self
,
sequence
=
None
,
**
kw
):
def
stepCheckWorkflowExists
(
self
,
sequence
=
None
,
**
kw
):
"""
"""
...
...
product/ERP5Type/ERP5Type.py
View file @
08867eee
...
@@ -455,7 +455,14 @@ class ERP5TypeInformation(XMLObject,
...
@@ -455,7 +455,14 @@ class ERP5TypeInformation(XMLObject,
'setTypeWorkflowList'
)
'setTypeWorkflowList'
)
def
setTypeWorkflowList
(
self
,
type_workflow_list
):
def
setTypeWorkflowList
(
self
,
type_workflow_list
):
"""Setter for 'type_workflow' property"""
"""Setter for 'type_workflow' property"""
self
.
workflow_list
=
type_workflow_list
# We use 'sorted' below to keep an order in the workflow list. Without
# this line, the actions can have different order depending on the order
# set during the installation or later. This is bad!
# It might not be the ideal solution, if you need to have the workflow
# defined in a specific order. Then, your new implementation should use
# indexes on workflows as in portal types action's priority.
# Note: 'sorted' also convert a tuple or a set to a list
self
.
workflow_list
=
sorted
(
type_workflow_list
)
def
getTypePropertySheetValueList
(
self
):
def
getTypePropertySheetValueList
(
self
):
type_property_sheet_list
=
self
.
getTypePropertySheetList
()
type_property_sheet_list
=
self
.
getTypePropertySheetList
()
...
...
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