[Erp5-report] r35773 kazuhiko - /erp5/trunk/products/ERP5/TargetSolver/SplitAndDefer.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon May 31 11:55:35 CEST 2010


Author: kazuhiko
Date: Mon May 31 11:55:32 2010
New Revision: 35773

URL: http://svn.erp5.org?rev=35773&view=rev
Log:
copy properties and categories as they are instead of depending on expandable property list specified in rule, so as to work for complicated rules.

Modified:
    erp5/trunk/products/ERP5/TargetSolver/SplitAndDefer.py

Modified: erp5/trunk/products/ERP5/TargetSolver/SplitAndDefer.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/TargetSolver/SplitAndDefer.py?rev=35773&r1=35772&r2=35773&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/TargetSolver/SplitAndDefer.py [utf8] (original)
+++ erp5/trunk/products/ERP5/TargetSolver/SplitAndDefer.py [utf8] Mon May 31 11:55:32 2010
@@ -27,6 +27,7 @@
 #
 ##############################################################################
 
+from Products.ERP5.MovementCollectionDiff import _getPropertyAndCategoryList
 from CopyToTarget import CopyToTarget
 from Acquisition import aq_base
 
@@ -51,34 +52,6 @@
     new_movement_quantity = delivery_quantity * simulation_movement.getDeliveryRatio()
     applied_rule = simulation_movement.getParentValue()
     rule = applied_rule.getSpecialiseValue()
-    expandable_property_list = []
-
-    if getattr(rule, 'getExpandablePropertyList', None) is not None:
-      expandable_property_list = rule.getExpandablePropertyList()
-    if len(expandable_property_list) == 0:
-      # hardcoded default for compatibility
-      expandable_property_list = (
-        'base_application_list',
-        'base_contribution_list',
-        'description',
-        'destination',
-        'destination_account',
-        'destination_function',
-        'destination_section',
-        'efficiency',
-        'price',
-        'price_currency',
-        'quantity_unit',
-        'resource',
-        'source',
-        'source_account',
-        'source_function',
-        'source_section',
-        'start_date',
-        'stop_date',
-        'variation_category_list',
-        'variation_property_dict',
-        )
 
     if movement_quantity > new_movement_quantity:
       split_index = 0
@@ -87,22 +60,16 @@
         split_index += 1
         new_id = "%s_split_%s" % (simulation_movement.getId(), split_index)
       # Adopt different dates for deferred movements
-      movement_dict = {}
+      movement_dict = _getPropertyAndCategoryList(simulation_movement)
       # new properties
       movement_dict.update(
         portal_type="Simulation Movement",
         id=new_id,
         quantity=movement_quantity - new_movement_quantity,
         activate_kw=self.activate_kw,
-        # 'order' category is deprecated. it is kept for compatibility.
-        order=simulation_movement.getOrder(),
+        delivery=None,
         **self.additional_parameters
       )
-
-      for prop in expandable_property_list:
-        if prop not in movement_dict: # XXX: better way to filter out
-          movement_dict.update(**{
-            prop: simulation_movement.getProperty(prop)})
       new_movement = applied_rule.newContent(**movement_dict)
       start_date = getattr(self, 'start_date', None)
       if start_date is not None:




More information about the Erp5-report mailing list