Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5-Boxiang
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
Hamza
erp5-Boxiang
Commits
8928e85b
Commit
8928e85b
authored
Mar 27, 2015
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Base.py: add compatibility features for ERP5 interaction workflow.
parent
568e7c96
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
38 deletions
+43
-38
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+43
-38
No files found.
product/ERP5Type/Base.py
View file @
8928e85b
...
...
@@ -181,14 +181,14 @@ class ERP5WorkflowMethod(Method):
return
apply
(
self
.
__dict__
[
'_m'
],
(
instance
,)
+
args
,
kw
)
if
erp5workflow_engaged
==
1
:
wf
5
_module
=
instance
.
getPortalObject
().
getDefaultModule
(
portal_type
=
"Workflow"
)
wf_module
=
instance
.
getPortalObject
().
getDefaultModule
(
portal_type
=
"Workflow"
)
### zwj: Build the list of method which is call and will be invoked.
valid_transition_item_list
=
[]
for
wf_id
,
transition_list
in
candidate_transition_item_list
:
valid_list
=
[]
for
transition_id
in
transition_list
:
LOG
(
'zwj: Type: %s Executing %s in %s'
%
(
instance
.
getPortalType
(),
transition_id
,
wf_id
),
WARNING
,
" in Base.py ERP5Workflow."
)
if
wf
5_module
.
_getOb
(
wf_id
).
isERP5WorkflowMethodSupported
(
instance
,
wf5
_module
.
_getOb
(
wf_id
).
_getOb
(
transition_id
)):
#
LOG('zwj: Type: %s Executing %s in %s' %(instance.getPortalType(), transition_id, wf_id), WARNING, " in Base.py ERP5Workflow.")
if
wf
_module
.
_getOb
(
wf_id
).
isERP5WorkflowMethodSupported
(
instance
,
wf
_module
.
_getOb
(
wf_id
).
_getOb
(
transition_id
)):
valid_list
.
append
(
transition_id
)
once_transition_key
=
once_transition_dict
.
get
((
wf_id
,
transition_id
))
transactional_variable
[
once_transition_key
]
=
1
...
...
@@ -216,7 +216,7 @@ class ERP5WorkflowMethod(Method):
for
wf_id
,
transition_list
in
valid_transition_item_list
:
try
:
for
tr
in
transition_list
:
method5
=
wf
5
_module
.
_getOb
(
wf_id
).
_getOb
(
tr
)
method5
=
wf_module
.
_getOb
(
wf_id
).
_getOb
(
tr
)
method5
.
execute
(
instance
)
except
ObjectDeleted
:
raise
ObjectDeleted
(
result
)
...
...
@@ -344,7 +344,7 @@ class WorkflowMethod(Method):
candidate_workflow
=
wf
[
wf_id
]
for
transition_id
in
transition_list
:
if
candidate_workflow
.
isWorkflowMethodSupported
(
instance
,
transition_id
):
LOG
(
'zwj: Type: %s Executing %s in %s'
%
(
instance
.
getPortalType
(),
transition_id
,
wf_id
),
WARNING
,
" in Base.py DCWorkflow."
)
#
LOG('zwj: Type: %s Executing %s in %s' %(instance.getPortalType(), transition_id, wf_id), WARNING, " in Base.py DCWorkflow.")
valid_list
.
append
(
transition_id
)
once_transition_key
=
once_transition_dict
.
get
((
wf_id
,
transition_id
))
if
once_transition_key
:
...
...
@@ -654,12 +654,16 @@ def getClassPropertyList(klass):
return
ps_list
def
intializePortalTypeERP5WorkflowMethod
(
ptype_klass
,
portal_ERP5Workflow
):
wf
5
_module
=
aq_inner
(
portal_ERP5Workflow
)
wf_module
=
aq_inner
(
portal_ERP5Workflow
)
portal_type
=
portal_ERP5Workflow
.
getPortalObject
().
getDefaultModule
(
portal_type
=
"portal_types"
)
pt
=
portal_type
.
_getOb
(
ptype_klass
.
__name__
,
None
)
workflow_dict
=
{}
interaction_workflow_dict
=
{}
for
ERP5Workflow_id
in
pt
.
erp5workflow_list
:
ERP5Workflow
=
wf5_module
.
_getOb
(
ERP5Workflow_id
)
ERP5Workflow
=
wf_module
.
_getOb
(
ERP5Workflow_id
)
wf_type
=
ERP5Workflow
.
getTypeInfo
().
getId
()
if
wf_type
==
'Workflow'
:
state_var
=
ERP5Workflow
.
getStateBaseCategory
()
### zwj: generate erp5worflow state var accessor, override base category accessor
for
method_id
,
getter
in
(
...
...
@@ -671,25 +675,26 @@ def intializePortalTypeERP5WorkflowMethod(ptype_klass, portal_ERP5Workflow):
WorkflowState
.
ERP5WorkflowStateTranslatedTitleGetter
),
(
'serialize%s'
%
UpperCase
(
state_var
),
WorkflowState
.
ERP5WorkflowStateSerializeGetter
),
):
#if not hasattr(ptype_klass, method_id):
### zwj: shouldn't override the DC accessors or the portal type using DCWorkflow will have problems
method
=
getter
(
method_id
,
ERP5Workflow_id
)
# Attach to portal_type
### zwj: if ERP5 Accessor has the same name as a defined DC accessor,
### it can't tell which accessor to execute,
### it will always check DC accessor first and ignore ERP5 accessor.
### thus it should register 2 types of accessor in different folder ???
ptype_klass
.
registerAccessor
(
method
,
Permissions
.
AccessContentsInformation
)
LOG
(
"zwj: Register Accessor %s of %s"
%
(
method_id
,
ERP5Workflow_id
),
WARNING
,
" in Base.py."
)
### zwj: generate erp5workflow mehtods
for
tr
in
wf5_module
.
_getOb
(
ERP5Workflow_id
).
objectValues
(
portal_type
=
"Transition"
):
tr_id
=
tr
.
id
transition_list
=
ERP5Workflow
.
objectValues
(
portal_type
=
"Transition"
)
storage
=
workflow_dict
elif
wf_type
==
'Interaction Workflow'
:
transition_list
=
ERP5Workflow
.
objectValues
(
portal_type
=
'Interaction'
)
storage
=
interaction_workflow_dict
else
:
continue
### zwj: geranrate workflow methods
for
tr
in
transition_list
:
if
tr
.
trigger_type
==
TRIGGER_WORKFLOW_METHOD
:
tr_id
=
tr
.
getId
()
method_id
=
convertToMixedCase
(
tr_id
)
ptype_klass
.
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
method_id
)
ptype_klass
.
registerERP5WorkflowMethod
(
method_id
,
ERP5Workflow_id
,
tr_id
,
0
)
LOG
(
"zwj:ERP5Workflow method %s is generated for %s "
%
(
tr_id
,
ERP5Workflow_id
),
WARNING
,
" in Base.py"
)
def
initializePortalTypeDynamicWorkflowMethods
(
ptype_klass
,
portal_workflow
):
"""We should now make sure workflow methods are defined
...
...
@@ -3428,7 +3433,7 @@ class Base( CopyContainer,
workflow
=
self
.
portal_workflow
.
getWorkflowById
(
wf_id
)
erp5workflow
=
self
.
workflow_module
.
_getOb
(
wf_id
,
None
)
LOG
(
'zwj: Loading %s'
%
erp5workflow
.
getId
(),
WARNING
,
'updating roles'
)
#
LOG('zwj: Loading %s'%erp5workflow.getId(), WARNING,'updating roles')
if
workflow
is
not
None
:
changed
=
workflow
.
updateRoleMappingsFor
(
self
)
if
changed
:
...
...
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