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
alecs_myu
erp5
Commits
4a204b8e
Commit
4a204b8e
authored
Apr 26, 2016
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_core: Allow to jump from a Property Sheet to the Portal Types where it's being used.
parent
1db1c8e3
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
211 additions
and
0 deletions
+211
-0
product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Property%20Sheet/jump_portal_types.xml
...eItem/portal_types/Property%20Sheet/jump_portal_types.xml
+100
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/PropertySheet_jumpToPortalTypeList.py
...tal_skins/erp5_core/PropertySheet_jumpToPortalTypeList.py
+27
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/PropertySheet_jumpToPortalTypeList.xml
...al_skins/erp5_core/PropertySheet_jumpToPortalTypeList.xml
+62
-0
product/ERP5/bootstrap/erp5_core/bt/template_action_path_list
...uct/ERP5/bootstrap/erp5_core/bt/template_action_path_list
+1
-0
product/ERP5Type/Core/PropertySheet.py
product/ERP5Type/Core/PropertySheet.py
+21
-0
No files found.
product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Property%20Sheet/jump_portal_types.xml
0 → 100644
View file @
4a204b8e
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ActionInformation"
module=
"Products.CMFCore.ActionInformation"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
action_type/object_jump
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
category
</string>
</key>
<value>
<string>
object_jump
</string>
</value>
</item>
<item>
<key>
<string>
condition
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
icon
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
jump_portal_types
</string>
</value>
</item>
<item>
<key>
<string>
permissions
</string>
</key>
<value>
<tuple>
<string>
View
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Action Information
</string>
</value>
</item>
<item>
<key>
<string>
priority
</string>
</key>
<value>
<float>
1.0
</float>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Portal Types
</string>
</value>
</item>
<item>
<key>
<string>
visible
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Expression"
module=
"Products.CMFCore.Expression"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
text
</string>
</key>
<value>
<string>
string:${object_url}/PropertySheet_jumpToPortalTypeList
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"Expression"
module=
"Products.CMFCore.Expression"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
text
</string>
</key>
<value>
<string>
python:portal.Base_checkPermission(\'portal_types\', \'View\')
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/PropertySheet_jumpToPortalTypeList.py
0 → 100644
View file @
4a204b8e
portal
=
context
.
getPortalObject
()
translateString
=
portal
.
Base_translateString
# XXX: Merge with BaseType_jumpToPropertySheetList
value_list
=
context
.
getRecursivePortalTypeValueList
()
if
not
len
(
value_list
):
return
context
.
Base_redirect
(
'view'
,
keep_items
=
{
'portal_status_message'
:
translateString
(
'No ${portal_type} related.'
,
mapping
=
{
'portal_type'
:
'Portal Type'
})})
elif
len
(
value_list
)
==
1
:
value
=
value_list
[
0
]
return
value
.
Base_redirect
(
'view'
,
keep_items
=
{
'portal_status_message'
:
translateString
(
'${this_portal_type} related to ${that_portal_type}: ${that_title}.'
,
mapping
=
{
'this_portal_type'
:
'Portal Type'
,
'that_portal_type'
:
context
.
getPortalType
(),
'that_title'
:
context
.
getTitleOrId
()})})
return
portal
.
portal_types
.
Base_redirect
(
'view'
,
keep_items
=
{
'reset'
:
1
,
'ignore_hide_rows'
:
1
,
'uid'
:
[
value
.
getUid
()
for
value
in
value_list
]})
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/PropertySheet_jumpToPortalTypeList.xml
0 → 100644
View file @
4a204b8e
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
PropertySheet_jumpToPortalTypeList
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/bootstrap/erp5_core/bt/template_action_path_list
View file @
4a204b8e
...
@@ -98,6 +98,7 @@ Property Existence Constraint | predicate
...
@@ -98,6 +98,7 @@ Property Existence Constraint | predicate
Property Existence Constraint | view
Property Existence Constraint | view
Property Sheet Tool | migrate_ps_from_fs
Property Sheet Tool | migrate_ps_from_fs
Property Sheet Tool | view
Property Sheet Tool | view
Property Sheet | jump_portal_types
Property Sheet | view
Property Sheet | view
Property Type Validity Constraint | predicate
Property Type Validity Constraint | predicate
Property Type Validity Constraint | view
Property Type Validity Constraint | view
...
...
product/ERP5Type/Core/PropertySheet.py
View file @
4a204b8e
...
@@ -196,3 +196,24 @@ class PropertySheet(Folder):
...
@@ -196,3 +196,24 @@ class PropertySheet(Folder):
LOG
(
"ERP5Type.Core.PropertySheet"
,
INFO
,
LOG
(
"ERP5Type.Core.PropertySheet"
,
INFO
,
"Invalid property '%s' for Property Sheet '%s': %s"
%
\
"Invalid property '%s' for Property Sheet '%s': %s"
%
\
(
property_definition
.
getId
(),
self
.
getId
(),
str
(
e
)))
(
property_definition
.
getId
(),
self
.
getId
(),
str
(
e
)))
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getRecursivePortalTypeValueList'
)
def
getRecursivePortalTypeValueList
(
self
):
"""
Get all the Portal Types where this Property Sheet is used
"""
portal
=
self
.
getPortalObject
()
property_sheet_id
=
self
.
getId
()
import
erp5.portal_type
portal_type_value_list
=
[]
for
portal_type
in
portal
.
portal_types
.
contentValues
():
portal_type_class
=
getattr
(
erp5
.
portal_type
,
portal_type
.
getId
())
portal_type_class
.
loadClass
()
for
klass
in
portal_type_class
.
mro
():
if
(
klass
.
__module__
==
'erp5.accessor_holder.property_sheet'
and
klass
.
__name__
==
property_sheet_id
):
portal_type_value_list
.
append
(
portal_type
)
return
portal_type_value_list
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