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
Alain Takoudjou
erp5
Commits
dcc4bfec
Commit
dcc4bfec
authored
Jun 19, 2015
by
wenjie.zheng
Committed by
Sebastien Robin
Jul 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Workflow.py: now in action list, action's reference is stored instead of id.
parent
1309a8f1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
3 deletions
+27
-3
product/ERP5Workflow/Document/Workflow.py
product/ERP5Workflow/Document/Workflow.py
+27
-3
No files found.
product/ERP5Workflow/Document/Workflow.py
View file @
dcc4bfec
...
...
@@ -33,9 +33,11 @@ from AccessControl import ClassSecurityInfo
from
AccessControl.unauthorized
import
Unauthorized
from
AccessControl.SecurityManagement
import
getSecurityManager
from
Acquisition
import
aq_base
,
aq_inner
,
aq_parent
from
DateTime
import
DateTime
from
copy
import
deepcopy
from
DateTime
import
DateTime
from
DocumentTemplate.DT_Util
import
TemplateDict
from
lxml
import
etree
from
lxml.etree
import
Element
,
SubElement
from
Products.CMFCore.Expression
import
Expression
from
Products.CMFCore.utils
import
getToolByName
from
Products.CMFCore.WorkflowCore
import
WorkflowException
,
ObjectDeleted
,
\
...
...
@@ -59,6 +61,7 @@ from Products.ERP5Workflow.Document.Transition import TRIGGER_AUTOMATIC,\
TRIGGER_USER_ACTION
,
TRIGGER_WORKFLOW_METHOD
from
tempfile
import
mktemp
from
types
import
StringTypes
from
zLOG
import
LOG
,
INFO
,
WARNING
class
Workflow
(
IdAsReferenceMixin
(
"workflow_"
,
"prefix"
),
XMLObject
):
"""
...
...
@@ -157,6 +160,7 @@ class Workflow(IdAsReferenceMixin("workflow_", "prefix"), XMLObject):
workflow_key
=
self
.
_generateHistoryKey
()
# Copy is requested
LOG
(
" workflow_history is '%s', object is '%s'"
%
(
document
.
workflow_history
,
document
.
getId
()),
WARNING
,
" in Workflow.py 162."
)
result
=
document
.
workflow_history
[
workflow_key
][
-
1
].
copy
()
return
result
...
...
@@ -337,7 +341,7 @@ class Workflow(IdAsReferenceMixin("workflow_", "prefix"), XMLObject):
fmt_data
.
_push
(
info
)
fmt_data
.
_push
({
'transition_id'
:
tid
})
res
.
append
((
tid
,
{
'id'
:
t
id
,
'id'
:
t
def
.
getReference
()
,
'name'
:
tdef
.
actbox_name
%
fmt_data
,
'url'
:
str
(
tdef
.
actbox_url
)
%
fmt_data
,
'icon'
:
str
(
tdef
.
actbox_icon
)
%
fmt_data
,
...
...
@@ -628,6 +632,7 @@ class Workflow(IdAsReferenceMixin("workflow_", "prefix"), XMLObject):
except
ObjectMoved
,
moved_exc
:
ob
=
moved_exc
.
getNewObject
()
# Re-raise after transition
LOG
(
"Executing transition '%s' before script '%s'"
%
(
tdef
.
getId
(),
script_id
),
WARNING
,
" in Workflows.py 631."
)
# update variables
state_values
=
None
...
...
@@ -683,7 +688,7 @@ class Workflow(IdAsReferenceMixin("workflow_", "prefix"), XMLObject):
tool
.
setStatusOf
(
self
.
getReference
(),
document
,
status_dict
)
sci
=
StateChangeInfo
(
document
,
self
,
former_status
,
tdef
,
old_sdef
,
new_sdef
,
kwargs
)
# put the error message in the workflow history
# put the error message in the workflow history
sci
.
setWorkflowVariable
(
error_message
=
before_script_error_message
)
if
validation_exc
:
# reraise validation failed exception
...
...
@@ -720,6 +725,7 @@ class Workflow(IdAsReferenceMixin("workflow_", "prefix"), XMLObject):
script
.
execute
(
sci
)
# May throw an exception.
else
:
raise
NotImplementedError
(
'Unsupported Script %s for state %s'
%
(
script_id
,
old_sdef
.
getReference
()))
LOG
(
"Executing transition '%s' after script '%s'"
%
(
tdef
.
getId
(),
script_id
),
WARNING
,
" in Workflows.py 726."
)
# Return the new state object.
if
moved_exc
is
not
None
:
# Propagate the notification that the object has moved.
...
...
@@ -727,6 +733,24 @@ class Workflow(IdAsReferenceMixin("workflow_", "prefix"), XMLObject):
else
:
return
new_sdef
def
showAsXML
(
self
,
root
=
None
):
workflow_prop_list
=
[
'id'
,
'configuration_after_script_id'
,
'state_base_category'
,
'state_variable'
,
'workflow_managed_permission_list'
]
if
root
is
None
:
root
=
Element
(
'ERP5Workflow'
)
return_as_object
=
False
object
=
SubElement
(
root
,
'object'
,
attrib
=
dict
(
id
=
self
.
getId
(),
portal_type
=
self
.
getPortalType
()))
for
prop_id
in
workflow_prop_list
:
value
=
self
.
getProperty
(
prop_id
)
if
value
is
None
:
continue
# build a structure to show in XML
sub_object
=
SubElemente
(
object
,
prop_id
,
prop_value
=
value
)
###########
## 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