Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Arnaud Fontaine
erp5
Commits
c9933e70
Commit
c9933e70
authored
Jun 19, 2018
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
composition mixin: Add getInheritedCategoryValueList
parent
3028f265
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
product/ERP5/mixin/composition.py
product/ERP5/mixin/composition.py
+23
-0
No files found.
product/ERP5/mixin/composition.py
View file @
c9933e70
...
...
@@ -256,6 +256,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