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
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nikola Balog
erp5
Commits
db37897b
Commit
db37897b
authored
Nov 21, 2014
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_core: change erp5_work flow to workflow5 to avoid conflict.
parent
9db5be20
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
98 additions
and
9 deletions
+98
-9
product/ERP5/bootstrap/erp5_core/PortalTypeBaseCategoryTemplateItem/base_category_list.xml
...PortalTypeBaseCategoryTemplateItem/base_category_list.xml
+1
-1
product/ERP5/bootstrap/erp5_core/TestTemplateItem/portal_components/test.erp5.testERP5Workflow.py
...plateItem/portal_components/test.erp5.testERP5Workflow.py
+96
-7
product/ERP5/bootstrap/erp5_core/bt/template_portal_type_base_category_list
...trap/erp5_core/bt/template_portal_type_base_category_list
+1
-1
No files found.
product/ERP5/bootstrap/erp5_core/PortalTypeBaseCategoryTemplateItem/base_category_list.xml
View file @
db37897b
...
...
@@ -3,7 +3,7 @@
<item>
specialise
</item>
</portal_type>
<portal_type
id=
"Base Type"
>
<item>
erp5_workflow
</item>
<item>
workflow5
</item>
</portal_type>
<portal_type
id=
"Conceptual Id Generator"
>
<item>
specialise
</item>
...
...
product/ERP5/bootstrap/erp5_core/TestTemplateItem/portal_components/test.erp5.testERP5Workflow.py
View file @
db37897b
...
...
@@ -66,9 +66,11 @@ class TestERP5Workflow(ERP5TypeTestCase):
def
test_Erp5Workflow
(
self
):
"""Tests the connection between ERP5Workflow and Objects."""
# Create a base category as the intermidiate
# Create base category as the intermidiate
self
.
portal
.
portal_categories
.
newContent
(
'category_state'
)
#self.portal.portal_categories.newContent('erp5_workflow')
# Create a workflow
new_workflow
=
self
.
workflow_module
.
newContent
(
portal_type
=
'Workflow'
,
id
=
'new_workflow'
)
...
...
@@ -84,7 +86,8 @@ class TestERP5Workflow(ERP5TypeTestCase):
# state variable
new_workflow
.
setStateBaseCategory
(
'category_state'
)
# create a portal type
# create a base type and a portal type based on this base type
type_object
=
self
.
portal
.
portal_types
.
newContent
(
portal_type
=
'Base Type'
,
id
=
'Object Type'
,
...
...
@@ -92,11 +95,12 @@ class TestERP5Workflow(ERP5TypeTestCase):
type_base_category_list
=
(
'category_state'
)
)
type_object
.
set
Erp5Workflow
Value
(
new_workflow
)
type_object
.
set
Workflow5
Value
(
new_workflow
)
self
.
assertEqual
(
type_object
.
getBaseCategoryList
(),
[
'erp5_workflow'
])
self
.
assertEqual
(
type_object
.
getErp5Workflow
(),
'workflow_module/new_workflow'
)
self
.
assertEqual
(
len
(
type_object
.
getErp5WorkflowValueList
()),
1
)
self
.
assertEqual
(
type_object
.
getBaseCategoryList
(),
[
'workflow5'
])
self
.
assertEqual
(
type_object
.
getWorkflow5
(),
'workflow_module/new_workflow'
)
self
.
assertEqual
(
len
(
type_object
.
getWorkflow5ValueList
()),
1
)
# create a module
self
.
portal
.
portal_types
.
newContent
(
...
...
@@ -114,6 +118,91 @@ class TestERP5Workflow(ERP5TypeTestCase):
self
.
assertEqual
(
new_object
.
getPortalType
(),
"Object Type"
)
self
.
assertEqual
(
new_object
.
getPortalType
(),
'Object Type'
)
self
.
assertEqual
(
new_object
.
getCategoryStateTitle
(),
'State 1'
)
def
test_Erp5Transition
(
self
):
"""Tests ERP5Workflow transition"""
# Create base category as the intermidiate
self
.
portal
.
portal_categories
.
newContent
(
'category_state'
)
self
.
portal
.
portal_categories
.
newContent
(
'category_transition'
)
# Create a workflow
new_workflow
=
self
.
workflow_module
.
newContent
(
portal_type
=
'Workflow'
,
id
=
'new_workflow'
)
s1
=
new_workflow
.
newContent
(
portal_type
=
'State'
,
title
=
'State 1'
)
s2
=
new_workflow
.
newContent
(
portal_type
=
'State'
,
title
=
'State 2'
)
t1
=
new_workflow
.
newContent
(
portal_type
=
'Transition'
,
title
=
'Transition 1'
,
id
=
'transition1'
)
t2
=
new_workflow
.
newContent
(
portal_type
=
'Transition'
,
title
=
'Transition 2'
,
id
=
'transition2'
)
s1
.
setDestinationValue
(
t1
)
s2
.
setDestinationValue
(
t2
)
t1
.
setDestinationValue
(
s2
)
t2
.
setDestinationValue
(
s1
)
# set initial state
new_workflow
.
setSourceValue
(
s1
)
# state variable
new_workflow
.
setStateBaseCategory
(
'category_state'
,
'category_transition'
)
# create a base type and a portal type based on this base type
type_object
=
self
.
portal
.
portal_types
.
newContent
(
portal_type
=
'Base Type'
,
id
=
'Object Type'
,
type_class
=
'XMLObject'
,
type_base_category_list
=
([
'category_state'
,
'category_transition'
])
)
type_object
.
setWorkflow5Value
(
new_workflow
)
self
.
assertEqual
(
type_object
.
getBaseCategoryList
(),
[
'workflow5'
])
self
.
assertEqual
(
type_object
.
getWorkflow5
(),
'workflow_module/new_workflow'
)
self
.
assertEqual
(
len
(
type_object
.
getWorkflow5ValueList
()),
1
)
# create a module
self
.
portal
.
portal_types
.
newContent
(
'Module Type'
,
'Base Type'
,
type_class
=
'Folder'
,
type_filter_content_type
=
1
,
type_allowed_content_type_list
=
(
'Object Type'
,))
self
.
portal
.
newContent
(
portal_type
=
'Module Type'
,
id
=
'new_module'
)
# create an object based on new-created portal type in the module
new_object
=
self
.
portal
.
new_module
.
newContent
(
portal_type
=
'Object Type'
,
id
=
'new_object'
)
self
.
assertTrue
(
new_object
is
not
None
)
self
.
assertEqual
(
new_object
.
getPortalType
(),
'Object Type'
)
self
.
assertEqual
(
new_object
.
getCategoryStateTitle
(),
'State 1'
)
# Pass transition
"""Method 1"""
t1
.
execute
(
new_object
)
self
.
assertEqual
(
new_object
.
getCategoryStateTitle
(),
'State 2'
)
t2
.
execute
(
new_object
)
self
.
assertEqual
(
new_object
.
getCategoryStateTitle
(),
'State 1'
)
"""Method 2"""
s1
.
executeTransition
(
t1
,
new_object
)
self
.
assertEqual
(
new_object
.
getCategoryStateTitle
(),
'State 2'
)
s2
.
executeTransition
(
t2
,
new_object
)
self
.
assertEqual
(
new_object
.
getCategoryStateTitle
(),
'State 1'
)
"""Method 3"""
new_object
.
getCategoryStateValue
().
executeTransition
(
new_workflow
.
transition1
,
new_object
)
self
.
assertEqual
(
new_object
.
getCategoryStateTitle
(),
'State 2'
)
new_object
.
getCategoryStateValue
().
executeTransition
(
new_workflow
.
transition2
,
new_object
)
self
.
assertEqual
(
new_object
.
getCategoryStateTitle
(),
'State 1'
)
#new_object.transition2a1()
def
test_suite
():
suite
=
unittest
.
TestSuite
()
...
...
product/ERP5/bootstrap/erp5_core/bt/template_portal_type_base_category_list
View file @
db37897b
Application Id Generator | specialise
Base Type |
erp5_workflow
Base Type |
workflow5
Conceptual Id Generator | specialise
Trash Bin | causality
\ No newline at end of file
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