Commit 192a4417 authored by Julien Muchembled's avatar Julien Muchembled

composition: inherit from parent only if empty, so that a child can override

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@39534 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f201eada
...@@ -220,9 +220,15 @@ class CompositionMixin: ...@@ -220,9 +220,15 @@ class CompositionMixin:
effective_set.add(model) effective_set.add(model)
if 1: #model.test(self): # XXX if 1: #model.test(self): # XXX
effective_list.append(model) effective_list.append(model)
# Inherit from parent only if empty, so that a child can override.
# This should not be an issue when a SO line is linked to transformation
# and the SO to a STC, because asComposedDocument should be called with
# different lists of portal types.
if _LEGACY_SIMULATION or not specialise_value_list:
parent = self.getParentValue() parent = self.getParentValue()
if hasattr(aq_base(parent), 'asComposedDocument'): if getattr(aq_base(parent), 'asComposedDocument', None) is not None:
parent = parent.asComposedDocument(specialise_type_list) parent = parent.asComposedDocument(specialise_type_list)
# return parent._effective_model_list, parent.getValueList('specialise')
specialise_value_list += parent.getValueList('specialise') specialise_value_list += parent.getValueList('specialise')
effective_list += [model for model in parent._effective_model_list effective_list += [model for model in parent._effective_model_list
if model not in effective_set] if model not in effective_set]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment