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
Paul Graydon
erp5
Commits
e136b3cd
Commit
e136b3cd
authored
Jan 05, 2015
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
======= ERP5Workflow uses validation_state from portal_categories. ======
parent
2f7e29b1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
32 deletions
+9
-32
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+6
-19
product/ERP5Type/ERP5Type.py
product/ERP5Type/ERP5Type.py
+0
-1
product/ERP5Type/dynamic/lazy_class.py
product/ERP5Type/dynamic/lazy_class.py
+3
-12
No files found.
product/ERP5Type/Base.py
View file @
e136b3cd
...
...
@@ -199,32 +199,19 @@ class ERP5WorkflowMethod(Method):
method5
.
execute
(
instance
)
def
registerERP5TransitionAlways
(
self
,
portal_type
,
workflow_id
,
transition_id
):
"""
Transitions registered as always will be invoked always
"""
transition_list
=
self
.
_invoke_always
.
setdefault
(
portal_type
,
{}).
setdefault
(
workflow_id
,
[])
if
transition_id
not
in
transition_list
:
transition_list
.
append
(
transition_id
)
self
.
registerERP5
()
def
registerERP5TransitionOncePerTransaction
(
self
,
portal_type
,
workflow_id
,
transition_id
):
"""
Transitions registered as one per transactions will be invoked
only once per transaction
"""
transition_list
=
self
.
_invoke_once
.
setdefault
(
portal_type
,
{}).
setdefault
(
workflow_id
,
[])
if
transition_id
not
in
transition_list
:
transition_list
.
append
(
transition_id
)
self
.
registerERP5
()
def
registerERP5
(
self
):
"""
Registers the method so that _aq_reset may later reset it
"""
erp5workflow_method_registry
.
append
(
self
)
def
reset
(
self
,
portal_type
=
None
):
"""
Reset the list of registered interactions or transitions
"""
if
portal_type
:
self
.
_invoke_once
[
portal_type
]
=
{}
self
.
_invoke_always
[
portal_type
]
=
{}
...
...
@@ -503,17 +490,17 @@ class PropertyHolder(object):
def
registerERP5WorkflowMethod
(
self
,
id
,
wf_id
,
tr_id
,
once_per_transaction
=
0
):
portal_type
=
self
.
portal_type
ERP5workflow_method
=
getattr
(
self
,
id
,
None
)
if
ERP5workflow_method
is
None
:
ERP5workflow_method
=
ERP5WorkflowMethod
(
Base
.
_doNothing
)
setattr
(
self
,
id
,
ERP5workflow_method
)
if
once_per_transaction
:
ERP5workflow_method
.
registerERP5TransitionOncePerTransaction
(
portal_type
,
if
ERP5workflow_method
.
__class__
.
__name__
==
"ERP5WorkflowMethod"
:
if
once_per_transaction
:
ERP5workflow_method
.
registerERP5TransitionOncePerTransaction
(
portal_type
,
wf_id
,
tr_id
)
else
:
ERP5workflow_method
.
registerERP5TransitionAlways
(
portal_type
,
else
:
ERP5workflow_method
.
registerERP5TransitionAlways
(
portal_type
,
wf_id
,
tr_id
)
...
...
@@ -642,7 +629,7 @@ def getClassPropertyList(klass):
def
intializePortalTypeERP5WorkflowMethod
(
ptype_klass
,
portal_ERP5Workflow
):
wf5_module
=
aq_inner
(
portal_ERP5Workflow
)
portal_type
=
portal_ERP5Workflow
.
getPortalObject
().
getDefaultModule
(
portal_type
=
"portal_types"
)
pt
=
portal_type
.
_getOb
(
ptype_klass
.
__name__
)
pt
=
portal_type
.
_getOb
(
ptype_klass
.
__name__
,
None
)
for
ERP5Workflow
in
pt
.
erp5workflow_list
:
for
tr
in
wf5_module
.
_getOb
(
ERP5Workflow
).
objectValues
(
portal_type
=
"Transition"
):
tr_id
=
tr
.
id
...
...
product/ERP5Type/ERP5Type.py
View file @
e136b3cd
...
...
@@ -418,7 +418,6 @@ class ERP5TypeInformation(XMLObject,
for
workflow
in
workflow_tool
.
getWorkflowsFor
(
ob
):
workflow
.
notifyCreated
(
ob
)
### zwj: checked 31 Dec 2104
for
ERP5Workflow
in
self
.
getTypeERP5WorkflowList
():
workflow_module
=
portal
.
getDefaultModule
(
portal_type
=
"Workflow"
)
if
workflow_module
is
not
None
:
...
...
product/ERP5Type/dynamic/lazy_class.py
View file @
e136b3cd
...
...
@@ -286,23 +286,14 @@ class PortalTypeMetaClass(GhostBaseMetaClass, PropertyHolder):
else
:
initializePortalTypeDynamicWorkflowMethods
(
cls
,
portal_workflow
)
portal_types
=
site
.
getDefaultModule
(
portal_type
=
"portal_types"
)
object_ptype
=
portal_types
.
_getOb
(
cls
.
__name__
,
None
)
if
hasattr
(
object_ptype
,
'erp5workflow_list'
):
ERP5Workflow
=
site
.
_getOb
(
"workflow_module"
,
None
)
if
ERP5Workflow
is
not
None
:
intializePortalTypeERP5WorkflowMethod
(
cls
,
ERP5Workflow
)
"""
portal_types
=
site
.
getDefaultModule
(
portal_type
=
"portal_types"
)
object_ptype
=
portal_types
.
_getOb
(
cls
.
__name__
,
None
)
if
object_ptype
is
not
None
:
workflow_list = getattr(object_ptype, 'erp5workflow_list', [])
if workflow_list is not []:
ERP5Workflow = getattr(site, "workflow_module", None)
if
object_ptype
.
getTypeERP5WorkflowList
()
is
not
():
ERP5Workflow
=
site
.
_getOb
(
"workflow_module"
,
None
)
if
ERP5Workflow
is
not
None
:
intializePortalTypeERP5WorkflowMethod
(
cls
,
ERP5Workflow
)
"""
# portal type group methods, isNodeType, isResourceType...
from
Products.ERP5Type.ERP5Type
import
ERP5TypeInformation
# XXX possible optimization:
...
...
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