Commit 3bfed678 authored by Julien Muchembled's avatar Julien Muchembled

Composition: drop support for model lines/cells on deliveries and movements

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@37671 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 72ca8290
...@@ -331,22 +331,6 @@ class SimulationMovement(PropertyRecordableMixin, Movement, ExplainableMixin): ...@@ -331,22 +331,6 @@ class SimulationMovement(PropertyRecordableMixin, Movement, ExplainableMixin):
if explanation_value != portal: if explanation_value != portal:
return explanation_value return explanation_value
def asComposedDocument(self, *args, **kw):
# XXX: What delivery should be used to find amount generator lines ?
# With the currently enabled code, entire branches in the simulation
# tree get (temporary) deleted when new delivery lines are being built
# (and don't have yet a specialise value).
# With the commented code, changing the STC on a SIT generated from a
# SPL/SO would have no impact (and would never make the SIT divergent).
#return self.getRootSimulationMovement() \
# .getDeliveryValue() \
# .asComposedDocument(*args, **kw)
while 1:
delivery_value = self.getDeliveryValue()
if delivery_value is not None:
return delivery_value.asComposedDocument(*args, **kw)
self = self.getParentValue().getParentValue()
# Deliverability / orderability # Deliverability / orderability
security.declareProtected( Permissions.AccessContentsInformation, security.declareProtected( Permissions.AccessContentsInformation,
'isOrderable') 'isOrderable')
......
...@@ -96,17 +96,15 @@ class TradeModelRuleMovementGenerator(MovementGeneratorMixin): ...@@ -96,17 +96,15 @@ class TradeModelRuleMovementGenerator(MovementGeneratorMixin):
def _getInputMovementList(self, movement_list=None, rounding=False): def _getInputMovementList(self, movement_list=None, rounding=False):
simulation_movement = self._applied_rule.getParentValue() simulation_movement = self._applied_rule.getParentValue()
trade_model = simulation_movement.asComposedDocument() specialise_list = simulation_movement.getSpecialiseList()
if trade_model is None:
return
rule = self._applied_rule.getSpecialiseValue() rule = self._applied_rule.getSpecialiseValue()
for amount in simulation_movement.getAggregatedAmountList( for amount in simulation_movement.getAggregatedAmountList(
# XXX add a 'trade_amount_generator' group type # XXX add a 'trade_amount_generator' group type
amount_generator_type_list=('Purchase Trade Condition', amount_generator_type_list=('Purchase Trade Condition',
'Sale Trade Condition', 'Sale Trade Condition',
'Trade Model Line')): 'Trade Model Line')):
yield self._applied_rule.newContent( movement = self._applied_rule.newContent(
portal_type=RuleMixin.movement_type, temp_object=True, portal_type=RuleMixin.movement_type, temp_object=True,
**dict((k, v) for k, v in amount.__dict__.iteritems() if k[0] != '_')) **dict((k, v) for k, v in amount.__dict__.iteritems() if k[0] != '_'))
movement._setSpecialiseList(specialise_list)
yield movement
...@@ -80,15 +80,10 @@ def _getEffectiveModel(self, start_date=None, stop_date=None): ...@@ -80,15 +80,10 @@ def _getEffectiveModel(self, start_date=None, stop_date=None):
# We do have clever caching here, since container_list does not contain objects # We do have clever caching here, since container_list does not contain objects
# with no subobject. Example: # with no subobject.
# If a SO (-> TC1, TC2) has 1 SOL (without specialise) and 1 TML, # After evaluation of asComposedDocument() on a SO and all its SOL,
# "SOL.asComposedDocument()" gives: # _findPredicateList's cache has at most 1 entry per specialise value found
# 1. _effective_model_list equals to # on SO/SOL.
# [SOL] + [SO, TC1, TC2] = [SOL, SO, TC1, TC2]
# 2. first call to objectValues passes container_list = [SO, TC1, TC2]
# to _findPredicateList (SOL being filtered out)
# After evaluation of "SOL.asComposedDocument()" and "SO.asComposedDocument()",
# _findPredicateList has only 1 entry in its cache.
@transactional_cached() @transactional_cached()
def _findPredicateList(container_list, portal_type=None): def _findPredicateList(container_list, portal_type=None):
predicate_list = [] predicate_list = []
...@@ -203,12 +198,10 @@ class CompositionMixin: ...@@ -203,12 +198,10 @@ class CompositionMixin:
model_set.add(model) model_set.add(model)
if 1: #model.test(self): # XXX if 1: #model.test(self): # XXX
model_list.append(model) model_list.append(model)
try: del model_list[0]
parent_asComposedDocument = self.getParentValue().asComposedDocument parent = self.getParentValue()
except AttributeError: if hasattr(aq_base(parent), 'asComposedDocument'):
pass model_list += [model for model in parent.asComposedDocument(
else:
model_list += [model for model in parent_asComposedDocument(
specialise_type_list)._effective_model_list specialise_type_list)._effective_model_list
if model not in model_set] if model not in model_set]
return model_list return model_list
......
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