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
Yusei Tahara
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
Show 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):
for
wf_id
,
transition_list
in
candidate_transition_item_list
:
valid_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():
valid_list
.
append
(
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 @@
##############################################################################
from
AccessControl
import
ClassSecurityInfo
from
Acquisition
import
aq_inner
from
Acquisition
import
aq_parent
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5Type.XMLObject
import
XMLObject
from
Products.ERP5Type.Globals
import
PersistentMapping
...
...
@@ -39,7 +40,7 @@ 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
#import String
from
DateTime
import
DateTime
class
Workflow
(
XMLObject
):
...
...
@@ -143,9 +144,8 @@ class Workflow(XMLObject):
transition_url
=
transition_url
,
state
=
state
)
# ========== Workflow5 Project, Wenjie, Dec 2014 ===============================
def
isWorkflow5MethodSupported
(
self
,
document
,
transition
,
wf_id
):
state
=
self
.
_getWorkflow5StateOf
(
document
,
wf_id
)
#state = document.getCategoryStateValue()
def
isWorkflow5MethodSupported
(
self
,
document
,
transition
):
state
=
self
.
_getWorkflow5StateOf
(
document
)
if
state
is
None
:
return
0
if
transition
in
state
.
getDestinationValueList
():
...
...
@@ -153,23 +153,15 @@ class Workflow(XMLObject):
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
()
def
_getWorkflow5StateOf
(
self
,
ob
):
bc_id
=
self
.
getStateBaseCategory
()
state_path
=
ob
.
getCategoryList
()
state_path
=
state_path
[
0
].
lstrip
(
"%s/"
%
bc_id
)
###
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