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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
erp5
Commits
87e565db
Commit
87e565db
authored
Jul 17, 2012
by
Aurel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add generator usefull for mass creation inside the same module using activities
parent
719c3361
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
product/ERP5Type/Core/Folder.py
product/ERP5Type/Core/Folder.py
+16
-0
No files found.
product/ERP5Type/Core/Folder.py
View file @
87e565db
...
@@ -213,6 +213,22 @@ class FolderMixIn(ExtensionClass.Base):
...
@@ -213,6 +213,22 @@ class FolderMixIn(ExtensionClass.Base):
self
.
_setLastId
(
my_id
)
# Make sure no reindexing happens
self
.
_setLastId
(
my_id
)
# Make sure no reindexing happens
return
my_id
return
my_id
def
_generatePerNodeNumberId
(
self
):
"""
Generate id base on node number, useful for import and mass creation
of objects inside a module using activities
We also append random id
"""
activity_tool
=
self
.
getPortalObject
().
portal_activities
node_list
=
list
(
activity_tool
.
getNodeList
())
current_node
=
activity_tool
.
getCurrentNode
()
try
:
node_number
=
node_list
.
index
(
current_node
)
except
ValueError
:
# Not a processing node
node_number
=
111
return
"%03d-%s"
%
(
node_number
,
self
.
_generateRandomId
())
# Automatic ID Generation method
# Automatic ID Generation method
security
.
declareProtected
(
Permissions
.
View
,
'generateNewId'
)
security
.
declareProtected
(
Permissions
.
View
,
'generateNewId'
)
def
generateNewId
(
self
,
id_group
=
None
,
default
=
None
,
method
=
None
):
def
generateNewId
(
self
,
id_group
=
None
,
default
=
None
,
method
=
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