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
Carlos Ramos Carreño
erp5
Commits
16ee8070
Commit
16ee8070
authored
Dec 15, 2014
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Workflow.py: isWorkflow5MethodSupport can accept variable from base category value.
parent
af391e63
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
5 deletions
+30
-5
product/ERP5Workflow/Document/Workflow.py
product/ERP5Workflow/Document/Workflow.py
+30
-5
No files found.
product/ERP5Workflow/Document/Workflow.py
View file @
16ee8070
...
...
@@ -31,12 +31,13 @@ from AccessControl import ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5Type.XMLObject
import
XMLObject
from
Products.ERP5Type.Globals
import
PersistentMapping
from
Products.ERP5Type.Accessor
import
WorkflowState
from
Products.ERP5Type
import
Permissions
from
tempfile
import
mktemp
import
os
from
Products.DCWorkflowGraph.config
import
DOT_EXE
from
Products.DCWorkflowGraph.DCWorkflowGraph
import
bin_search
,
getGraph
from
Products.ERP5Type.Utils
import
UpperCase
from
Acquisition
import
aq_base
from
DateTime
import
DateTime
...
...
@@ -51,6 +52,9 @@ class Workflow(XMLObject):
add_permission
=
Permissions
.
AddPortalContent
isPortalContent
=
1
isRADContent
=
1
### register the variable given by "base category value"
#state_var = 'state'
### In DCworkflow; state/transition can be registered inside workflow
# Declarative security
security
=
ClassSecurityInfo
()
...
...
@@ -138,14 +142,35 @@ class Workflow(XMLObject):
transition
=
transition
,
transition_url
=
transition_url
,
state
=
state
)
def
isWorkflow5MethodSupported
(
self
,
document
,
transition
):
state
=
document
.
getCategoryStateValue
()
# ========== Workflow5 Project, Wenjie, Dec 2014 ===============================
def
isWorkflow5MethodSupported
(
self
,
document
,
transition
,
wf_id
):
state
=
self
.
_getWorkflow5StateOf
(
document
,
wf_id
)
#state = document.getCategoryStateValue()
if
state
is
None
:
return
0
if
transition
in
state
.
getDestinationValueList
():
return
1
return
0
### get workflow state from base category value:
def
_getWorkflow5StateOf
(
self
,
ob
,
wf_id
):
### the problem is that: How to pass state_id from base_category
getter
=
WorkflowState
.
Getter
#ptype_klass = self.getPortalObject().portal_types.getPortalTypeClass(ob.getTypeInfo().getId())
ptype_klass
=
ob
.
getTypeInfo
().
__class__
#raise NotImplementedError (ptype_klass)#class 'erp5.portal_type.Base Type'
StateGetter
=
getter
(
'get%s'
%
UpperCase
(
self
.
getStateBaseCategory
()),
wf_id
)
ptype_klass
.
registerAccessor
(
StateGetter
)
# raise NotImplementedError (StateGetter._id)# getCategoryState
state_path
=
ob
.
getCategoryState
()
###
if
state_path
is
not
None
:
state
=
self
.
restrictedTraverse
(
state_path
)
#state = self._getOb(state_id)
else
:
state
=
None
return
state
# =========== WF5 ==============================================================
###########
## Graph ##
############
...
...
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