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
0f3124f2
Commit
0f3124f2
authored
Apr 29, 2015
by
wenjie.zheng
Committed by
Sebastien Robin
Jul 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Workflow.py: add suffix removement to resolve workflow history generation problem.
parent
ff42a339
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
product/ERP5Workflow/Document/Workflow.py
product/ERP5Workflow/Document/Workflow.py
+12
-8
No files found.
product/ERP5Workflow/Document/Workflow.py
View file @
0f3124f2
...
...
@@ -104,7 +104,8 @@ class Workflow(IdAsReferenceMixin('_workflow'), XMLObject):
object
=
self
.
getStateChangeInformation
(
document
,
self
.
getSourceValue
())
# Initialize workflow history
status_dict
=
{
state_var
:
self
.
getSourceId
()}
state_id
=
'_'
.
join
(
self
.
getSourceId
().
split
(
'_'
)[:
-
1
])
status_dict
=
{
state_var
:
state_id
}
variable_list
=
self
.
objectValues
(
portal_type
=
'Variable'
)
former_status
=
self
.
_getOb
(
status_dict
[
state_var
],
None
)
ec
=
Expression_createExprContext
(
StateChangeInfo
(
document
,
self
,
former_status
))
...
...
@@ -127,7 +128,7 @@ class Workflow(IdAsReferenceMixin('_workflow'), XMLObject):
Generate a key used in the workflow history.
"""
history_key
=
self
.
unrestrictedTraverse
(
self
.
getRelativeUrl
()).
getId
()
return
history_key
return
'_'
.
join
(
history_key
.
split
(
'_'
)[:
-
1
])
def
_updateWorkflowHistory
(
self
,
document
,
status_dict
):
"""
...
...
@@ -470,34 +471,37 @@ class Workflow(IdAsReferenceMixin('_workflow'), XMLObject):
return
ob
.
_getDefaultAcquiredValue
(
state_var
).
getId
()
vdef
=
self
.
_getOb
(
name
)
LOG
(
'
zwj
: vdef is %s'
%
vdef
.
getId
(),
WARNING
,
' in Workflow.py.'
)
LOG
(
'
474
: vdef is %s'
%
vdef
.
getId
(),
WARNING
,
' in Workflow.py.'
)
status_dict
=
self
.
getCurrentStatusDict
(
ob
)
former_status
=
self
.
_getOb
(
status_dict
[
state_var
],
None
)
if
former_status
==
None
:
former_status
=
self
.
getSourceValue
()
if
vdef
.
info_guard
is
not
None
and
not
vdef
.
info_guard
.
check
(
getSecurityManager
(),
self
,
ob
):
return
default
LOG
(
'
zwj
: Pass Info guard'
,
WARNING
,
' in Workflow.py.'
)
LOG
(
'
484
: Pass Info guard'
,
WARNING
,
' in Workflow.py.'
)
if
status_dict
is
not
None
and
name
in
status_dict
:
value
=
status_dict
[
name
]
# Not set yet. Use a default.
if
vdef
.
default_expr
is
not
None
:
LOG
(
'
zwj
: executing default_expr '
,
WARNING
,
' in Workflow.py.'
)
LOG
(
'
490
: executing default_expr '
,
WARNING
,
' in Workflow.py.'
)
ec
=
Expression_createExprContext
(
StateChangeInfo
(
ob
,
self
,
former_status
))
expr
=
Expression
(
vdef
.
default_expr
)
value
=
expr
(
ec
)
else
:
value
=
vdef
.
default_value
LOG
(
'
zwj
: generated value successfully '
,
WARNING
,
' in Workflow.py.'
)
LOG
(
'
496
: generated value successfully '
,
WARNING
,
' in Workflow.py.'
)
return
value
def
_getWorkflowStateOf
(
self
,
ob
,
id_only
=
0
):
tool
=
getToolByName
(
self
,
'portal_workflow'
)
status
=
tool
.
getStatusOf
(
self
.
id
,
ob
)
id_no_suffix
=
'_'
.
join
(
self
.
id
.
split
(
'_'
)[:
-
1
])
status
=
tool
.
getStatusOf
(
id_no_suffix
,
ob
)
LOG
(
"502 tool is '%s' type, status is '%s'"
%
(
tool
.
getPortalType
(),
status
),
WARNING
,
" in Workflow.py"
)
if
status
is
None
:
state
=
self
.
getSourceId
()
else
:
...
...
@@ -505,7 +509,7 @@ class Workflow(IdAsReferenceMixin('_workflow'), XMLObject):
if
state
is
None
:
state
=
self
.
getSourceId
()
if
id_only
:
return
state
return
'_'
.
join
(
state
.
split
(
'_'
)[:
-
1
])
else
:
return
self
.
_getOb
(
state
,
None
)
...
...
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