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
Hamza
erp5
Commits
a1c8a8a2
Commit
a1c8a8a2
authored
Apr 30, 2015
by
wenjie.zheng
Committed by
Sebastien Robin
Jul 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
id_as_reference.py: resolve reference can't not be saved.
parent
f4fcbec4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
product/ERP5Type/id_as_reference.py
product/ERP5Type/id_as_reference.py
+15
-2
No files found.
product/ERP5Type/id_as_reference.py
View file @
a1c8a8a2
...
...
@@ -85,11 +85,24 @@ def IdAsReferenceMixin(extra_string, string_type="suffix"):
return
getattr
(
aq_base
(
self
),
'default_reference'
,
(
args
or
[
None
])[
0
])
def
_setReference
(
self
,
value
):
parent
=
self
.
getParentValue
()
self
.
__dict__
.
pop
(
'default_reference'
,
None
)
if
string_type
==
"prefix"
:
self
.
setId
(
extra_string
+
value
)
new_id
=
extra_string
+
value
if
parent
.
has_key
(
new_id
):
LOG
(
"IdAsReferenceMixin"
,
WARNING
,
"Skipping adding of %r in %r"
" property sheet, due to ID conflict"
%
(
new_id
,
parent
.
getId
()))
else
:
self
.
setId
(
new_id
)
self
.
default_reference
=
value
# to save reference in workflow tool.
elif
string_type
==
"suffix"
:
self
.
setId
(
value
+
extra_string
)
new_id
=
value
+
extra_string
if
parent
.
has_key
(
new_id
):
LOG
(
"IdAsReferenceMixin"
,
WARNING
,
"Skipping adding of %r in %r"
" property sheet, due to ID conflict"
%
(
new_id
,
parent
.
getId
()))
else
:
self
.
setId
(
new_id
)
self
.
default_reference
=
value
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'setReference'
)
setReference
=
_setReference
...
...
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