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
1
Merge Requests
1
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
Cédric Le Ninivin
erp5
Commits
f45f2b5d
Commit
f45f2b5d
authored
Jun 19, 2018
by
Cédric Le Ninivin
Committed by
Cédric Le Ninivin
May 29, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
composition mixin: Add getInheritedCategoryValueList
parent
e0ffd108
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
product/ERP5/bootstrap/erp5_core/MixinTemplateItem/portal_components/mixin.erp5.CompositionMixin.py
...lateItem/portal_components/mixin.erp5.CompositionMixin.py
+23
-0
No files found.
product/ERP5/bootstrap/erp5_core/MixinTemplateItem/portal_components/mixin.erp5.CompositionMixin.py
View file @
f45f2b5d
...
...
@@ -254,6 +254,29 @@ class CompositionMixin:
specialise_type_list
,
portal_type_set
)
return
specialise_list
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getInheritedCategoryValueList'
)
def
getInheritedCategoryValueList
(
self
,
category
,
category_type_list
=
None
,
exclude_category_type_list
=
()):
"""Get inherited category values
Values are inherited from parent only if portal types differ,
so that a child can override.
"""
portal_type_set
=
set
()
category_list
=
[]
for
value
in
self
.
_getValueList
(
category
):
portal_type
=
value
.
getPortalType
()
if
not
(
portal_type
in
exclude_category_type_list
or
category_type_list
and
portal_type
not
in
category_type_list
):
portal_type_set
.
add
(
portal_type
)
category_list
.
append
(
value
)
parent
=
self
.
getParentValue
()
if
isinstance
(
parent
,
CompositionMixin
):
portal_type_set
.
update
(
exclude_category_type_list
)
category_list
+=
parent
.
getInheritedCategoryValueList
(
category
,
category_type_list
,
portal_type_set
)
return
category_list
del
asComposedDocument
# to be unhidden (and renamed ?) if needed
InitializeClass
(
CompositionMixin
)
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