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
amrani
erp5
Commits
206b5b59
Commit
206b5b59
authored
Jul 31, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bt5_config: Override accessors for type_workflow_list property for ERP5TypeInformation
parent
3fd72ad8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
13 deletions
+38
-13
product/ERP5Type/ERP5Type.py
product/ERP5Type/ERP5Type.py
+38
-13
No files found.
product/ERP5Type/ERP5Type.py
View file @
206b5b59
...
...
@@ -227,7 +227,6 @@ class ERP5TypeInformation(XMLObject,
acquire_local_roles
=
False
property_sheet_list
=
()
base_category_list
=
()
workflow_list
=
()
init_script
=
''
product
=
'ERP5Type'
hidden_content_type_list
=
()
...
...
@@ -334,22 +333,48 @@ class ERP5TypeInformation(XMLObject,
def
getTypeInitScriptId
(
self
):
return
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'getTypeWorkflowList'
)
def
getTypeWorkflowList
(
self
):
"""Getter for 'type_workflow' property"""
return
list
(
self
.
workflow_list
)
"""Getter for 'type_workflow_list' property"""
pw
=
self
.
getPortalObject
().
portal_workflow
cbt
=
pw
.
_chains_by_type
id
=
self
.
getId
()
if
cbt
is
not
None
and
cbt
.
has_key
(
id
):
workflow_list
=
list
(
cbt
[
id
])
else
:
workflow_list
=
[
'(Default)'
,]
return
workflow_list
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'setTypeWorkflowList'
)
def
setTypeWorkflowList
(
self
,
type_workflow_list
):
"""Setter for 'type_workflow' property"""
# We use 'sorted' below to keep an order in the workflow list. Without
# this line, the actions can have different order depending on the order
# set during the installation or later. This is bad!
# It might not be the ideal solution, if you need to have the workflow
# defined in a specific order. Then, your new implementation should use
# indexes on workflows as in portal types action's priority.
# Note: 'sorted' also convert a tuple or a set to a list
self
.
workflow_list
=
sorted
(
type_workflow_list
)
def
_setTypeWorkflowList
(
self
,
type_workflow_list
):
"""Override Setter for 'type_workflow' property"""
# We use setter to update the value for Workflow chain during the
# installation of Business Manager. This way, we would be able to
# modify workflow chain without the need of saving anything in
# type_workflow_list property.
# If type_workflow_list is '(Default)', don't do/update anything
if
type_workflow_list
[
0
]
!=
'(Default)'
:
portal
=
self
.
getPortalObject
()
pw
=
portal
.
portal_workflow
cbt
=
pw
.
_chains_by_type
id
=
self
.
getId
()
# If there is already key existing in cbt, then update it
if
cbt
is
not
None
and
cbt
.
has_key
(
id
):
workflow_list
=
list
(
cbt
(
id
))
# If the value in cbt is '(Default)', then update it only after removing
# default value
if
workflow_list
[
0
]
!=
'(Default)'
:
type_workflow_list
=
type_workflow_list
.
extend
(
workflow_list
)
cbt
[
id
]
=
type_workflow_list
cbt
[
id
]
=
sorted
(
type_workflow_list
)
# Update the chains dictionary for portal_workflow
pw
.
_chains_by_type
=
cbt
security
.
declarePrivate
(
'_guessMethodAliases'
)
def
_guessMethodAliases
(
self
):
...
...
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