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
Titouan Soulard
erp5
Commits
c15cd672
Commit
c15cd672
authored
Sep 15, 2011
by
Nicolas Delaby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add public method to clone a selection
Its name will be prefixed
parent
0b8deebc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletion
+16
-1
product/ERP5Form/Tool/SelectionTool.py
product/ERP5Form/Tool/SelectionTool.py
+16
-1
No files found.
product/ERP5Form/Tool/SelectionTool.py
View file @
c15cd672
...
@@ -50,7 +50,7 @@ from zLOG import LOG, INFO
...
@@ -50,7 +50,7 @@ from zLOG import LOG, INFO
from
Acquisition
import
aq_base
from
Acquisition
import
aq_base
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Type.Message
import
translateString
import
warnings
import
warnings
from
copy
import
deepcopy
_MARKER
=
[]
_MARKER
=
[]
...
@@ -270,6 +270,21 @@ class SelectionTool( BaseTool, SimpleItem ):
...
@@ -270,6 +270,21 @@ class SelectionTool( BaseTool, SimpleItem ):
if
selection
is
not
None
:
if
selection
is
not
None
:
return
selection
.
__of__
(
self
)
return
selection
.
__of__
(
self
)
security
.
declareProtected
(
ERP5Permissions
.
AddPortalContent
,
'cloneSelectionFor'
)
def
cloneSelectionFor
(
self
,
selection_name
,
prefix
=
'cloned_'
):
"""For deferred listbox
"""
if
not
selection_name
or
not
prefix
:
return
None
selection
=
self
.
_getSelectionFromContainer
(
selection_name
)
cloned_selection
=
deepcopy
(
selection
)
selection_name
=
'%s%s'
%
(
prefix
,
selection_name
)
self
.
setSelectionFor
(
selection_name
,
cloned_selection
)
parameter_dict
=
cloned_selection
.
getParams
()
parameter_dict
[
'selection_name'
]
=
selection_name
cloned_selection
.
edit
(
params
=
parameter_dict
)
return
cloned_selection
.
__of__
(
self
)
def
__getitem__
(
self
,
key
):
def
__getitem__
(
self
,
key
):
return
self
.
getSelectionParamsFor
(
key
)
return
self
.
getSelectionParamsFor
(
key
)
...
...
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