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
Ekaterina
erp5
Commits
9c9e243a
Commit
9c9e243a
authored
Dec 18, 2019
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_core] Use Base_redirect to jump to a module
This improve the compatibility with ERP5JS
parent
383fdb19
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
15 deletions
+8
-15
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_jumpToRelatedObject.py
...teItem/portal_skins/erp5_core/Base_jumpToRelatedObject.py
+8
-15
No files found.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_jumpToRelatedObject.py
View file @
9c9e243a
...
@@ -3,6 +3,8 @@ portal = context.getPortalObject()
...
@@ -3,6 +3,8 @@ portal = context.getPortalObject()
Base_translateString
=
portal
.
Base_translateString
Base_translateString
=
portal
.
Base_translateString
checkPerm
=
portal
.
portal_membership
.
checkPermission
checkPerm
=
portal
.
portal_membership
.
checkPermission
redirect_context
=
context
if
jump_from_relative_url
is
None
:
if
jump_from_relative_url
is
None
:
relation
=
context
relation
=
context
else
:
else
:
...
@@ -39,7 +41,6 @@ related_list = search_method(portal_type = portal_type)
...
@@ -39,7 +41,6 @@ related_list = search_method(portal_type = portal_type)
relation_found
=
0
relation_found
=
0
if
len
(
related_list
)
==
0
:
if
len
(
related_list
)
==
0
:
url
=
context
.
absolute_url
()
message
=
Base_translateString
(
message
=
Base_translateString
(
'No %s Related'
%
portal_type
[
0
],
'No %s Related'
%
portal_type
[
0
],
default
=
Base_translateString
(
'No ${portal_type} related.'
,
default
=
Base_translateString
(
'No ${portal_type} related.'
,
...
@@ -58,7 +59,7 @@ elif len(related_list) == 1:
...
@@ -58,7 +59,7 @@ elif len(related_list) == 1:
form_id
=
target_form_id
form_id
=
target_form_id
else
:
else
:
form_id
=
'view'
form_id
=
'view'
url
=
related_object
.
absolute_url
()
redirect_context
=
related_object
message
=
Base_translateString
(
message
=
Base_translateString
(
# first, try to get a full translated message with portal types
# first, try to get a full translated message with portal types
"%s related to %s."
%
(
related_object
.
getPortalType
(),
context
.
getPortalType
()),
"%s related to %s."
%
(
related_object
.
getPortalType
(),
context
.
getPortalType
()),
...
@@ -68,7 +69,6 @@ elif len(related_list) == 1:
...
@@ -68,7 +69,6 @@ elif len(related_list) == 1:
"that_portal_type"
:
context
.
getTranslatedPortalType
(),
"that_portal_type"
:
context
.
getTranslatedPortalType
(),
"that_title"
:
context
.
getTitleOrId
()
}),)
"that_title"
:
context
.
getTitleOrId
()
}),)
else
:
else
:
url
=
context
.
absolute_url
()
message
=
Base_translateString
(
"You are not authorised to view the related document."
)
message
=
Base_translateString
(
"You are not authorised to view the related document."
)
relation_found
=
0
relation_found
=
0
...
@@ -105,25 +105,18 @@ else:
...
@@ -105,25 +105,18 @@ else:
if
obj
is
not
None
and
checkPerm
(
"View"
,
obj
):
if
obj
is
not
None
and
checkPerm
(
"View"
,
obj
):
related_object_list
.
append
(
obj
)
related_object_list
.
append
(
obj
)
if
len
(
related_object_list
)
==
0
:
if
len
(
related_object_list
)
==
0
:
url
=
context
.
absolute_url
()
message
=
Base_translateString
(
"You are not authorised to view any related document."
)
message
=
Base_translateString
(
"You are not authorised to view any related document."
)
relation_found
=
0
relation_found
=
0
else
:
else
:
request
=
portal
.
REQUEST
selection_uid_list
=
[
x
.
getUid
()
for
x
in
related_object_list
]
selection_uid_list
=
[
x
.
getUid
()
for
x
in
related_object_list
]
kw
=
{
'uid'
:
selection_uid_list
}
return
context
.
Base_redirect
(
relation_form_id
,
portal
.
portal_selections
.
setSelectionParamsFor
(
keep_items
=
dict
(
reset
=
1
,
'Base_jumpToRelatedObjectList'
,
kw
)
uid
=
selection_uid_list
))
request
.
set
(
'object_uid'
,
context
.
getUid
())
request
.
set
(
'uids'
,
selection_uid_list
)
return
getattr
(
context
,
relation_form_id
)(
uids
=
selection_uid_list
,
REQUEST
=
request
)
query_params
=
dict
(
portal_status_message
=
message
)
query_params
=
dict
(
portal_status_message
=
message
)
if
selection_name
and
not
relation_found
:
if
selection_name
and
not
relation_found
:
query_params
[
'selection_name'
]
=
selection_name
query_params
[
'selection_name'
]
=
selection_name
query_params
[
'selection_index'
]
=
selection_index
query_params
[
'selection_index'
]
=
selection_index
return
redirect_context
.
Base_redirect
(
redirect_url
=
'%s/%s?%s'
%
(
url
,
form_id
,
make_query
(
query_params
))
form_id
,
keep_items
=
query_params
)
return
context
.
REQUEST
[
'RESPONSE'
].
redirect
(
redirect_url
)
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