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
1
Merge Requests
1
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
Boxiang Sun
erp5
Commits
709412b4
Commit
709412b4
authored
Dec 15, 2014
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Workflow.py: Universal method based on lstrip to access base category variables.
parent
16ee8070
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
18 deletions
+10
-18
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+1
-1
product/ERP5Workflow/Document/Workflow.py
product/ERP5Workflow/Document/Workflow.py
+9
-17
No files found.
product/ERP5Type/Base.py
View file @
709412b4
...
@@ -207,7 +207,7 @@ class WorkflowMethod(Method):
...
@@ -207,7 +207,7 @@ class WorkflowMethod(Method):
for
wf_id
,
transition_list
in
candidate_transition_item_list
:
for
wf_id
,
transition_list
in
candidate_transition_item_list
:
valid_list
=
[]
valid_list
=
[]
for
transition_id
in
transition_list
:
for
transition_id
in
transition_list
:
if
wf5_module
.
_getOb
(
wf_id
).
isWorkflow5MethodSupported
(
instance
,
wf5_module
.
_getOb
(
wf_id
).
_getOb
(
transition_id
)
,
wf_id
):
if
wf5_module
.
_getOb
(
wf_id
).
isWorkflow5MethodSupported
(
instance
,
wf5_module
.
_getOb
(
wf_id
).
_getOb
(
transition_id
)):
#if wf5_module._getOb(wf_id)._getOb(transition_id) in instance.getCategoryStateValue().getDestinationValueList():
#if wf5_module._getOb(wf_id)._getOb(transition_id) in instance.getCategoryStateValue().getDestinationValueList():
valid_list
.
append
(
transition_id
)
valid_list
.
append
(
transition_id
)
once_transition_key
=
once_transition_dict
.
get
((
wf_id
,
transition_id
))
once_transition_key
=
once_transition_dict
.
get
((
wf_id
,
transition_id
))
...
...
product/ERP5Workflow/Document/Workflow.py
View file @
709412b4
...
@@ -27,7 +27,8 @@
...
@@ -27,7 +27,8 @@
##############################################################################
##############################################################################
from
AccessControl
import
ClassSecurityInfo
from
AccessControl
import
ClassSecurityInfo
from
Acquisition
import
aq_inner
from
Acquisition
import
aq_parent
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5Type.XMLObject
import
XMLObject
from
Products.ERP5Type.XMLObject
import
XMLObject
from
Products.ERP5Type.Globals
import
PersistentMapping
from
Products.ERP5Type.Globals
import
PersistentMapping
...
@@ -39,7 +40,7 @@ from Products.DCWorkflowGraph.config import DOT_EXE
...
@@ -39,7 +40,7 @@ from Products.DCWorkflowGraph.config import DOT_EXE
from
Products.DCWorkflowGraph.DCWorkflowGraph
import
bin_search
,
getGraph
from
Products.DCWorkflowGraph.DCWorkflowGraph
import
bin_search
,
getGraph
from
Products.ERP5Type.Utils
import
UpperCase
from
Products.ERP5Type.Utils
import
UpperCase
from
Acquisition
import
aq_base
from
Acquisition
import
aq_base
#import String
from
DateTime
import
DateTime
from
DateTime
import
DateTime
class
Workflow
(
XMLObject
):
class
Workflow
(
XMLObject
):
...
@@ -143,9 +144,8 @@ class Workflow(XMLObject):
...
@@ -143,9 +144,8 @@ class Workflow(XMLObject):
transition_url
=
transition_url
,
transition_url
=
transition_url
,
state
=
state
)
state
=
state
)
# ========== Workflow5 Project, Wenjie, Dec 2014 ===============================
# ========== Workflow5 Project, Wenjie, Dec 2014 ===============================
def
isWorkflow5MethodSupported
(
self
,
document
,
transition
,
wf_id
):
def
isWorkflow5MethodSupported
(
self
,
document
,
transition
):
state
=
self
.
_getWorkflow5StateOf
(
document
,
wf_id
)
state
=
self
.
_getWorkflow5StateOf
(
document
)
#state = document.getCategoryStateValue()
if
state
is
None
:
if
state
is
None
:
return
0
return
0
if
transition
in
state
.
getDestinationValueList
():
if
transition
in
state
.
getDestinationValueList
():
...
@@ -153,23 +153,15 @@ class Workflow(XMLObject):
...
@@ -153,23 +153,15 @@ class Workflow(XMLObject):
return
0
return
0
### get workflow state from base category value:
### get workflow state from base category value:
def
_getWorkflow5StateOf
(
self
,
ob
,
wf_id
):
def
_getWorkflow5StateOf
(
self
,
ob
):
### the problem is that: How to pass state_id from base_category
bc_id
=
self
.
getStateBaseCategory
()
getter
=
WorkflowState
.
Getter
state_path
=
ob
.
getCategoryList
()
#ptype_klass = self.getPortalObject().portal_types.getPortalTypeClass(ob.getTypeInfo().getId())
state_path
=
state_path
[
0
].
lstrip
(
"%s/"
%
bc_id
)
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
:
if
state_path
is
not
None
:
state
=
self
.
restrictedTraverse
(
state_path
)
state
=
self
.
restrictedTraverse
(
state_path
)
#state = self._getOb(state_id)
else
:
state
=
None
else
:
state
=
None
return
state
return
state
# =========== WF5 ==============================================================
# =========== WF5 ==============================================================
###########
###########
## Graph ##
## 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