[Erp5-report] r33649 kazuhiko - /erp5/trunk/bt5/erp5_simulation/DocumentTemplateItem/

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Mar 11 15:12:51 CET 2010


Author: kazuhiko
Date: Thu Mar 11 15:12:50 2010
New Revision: 33649

URL: http://svn.erp5.org?rev=33649&view=rev
Log:
some comments from Jean-Paul.

Modified:
    erp5/trunk/bt5/erp5_simulation/DocumentTemplateItem/TradeModelSimulationRule.py

Modified: erp5/trunk/bt5/erp5_simulation/DocumentTemplateItem/TradeModelSimulationRule.py
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_simulation/DocumentTemplateItem/TradeModelSimulationRule.py?rev=33649&r1=33648&r2=33649&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_simulation/DocumentTemplateItem/TradeModelSimulationRule.py [utf8] (original)
+++ erp5/trunk/bt5/erp5_simulation/DocumentTemplateItem/TradeModelSimulationRule.py [utf8] Thu Mar 11 15:12:50 2010
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 ##############################################################################
 #
 # Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
@@ -28,7 +29,7 @@
 XXX This file is experimental for new simulation implementation, and
 will replace DeliveryRule.
 """
-
+from zLOG import LOG
 import zope.interface
 from AccessControl import ClassSecurityInfo
 from Products.ERP5Type import Permissions, PropertySheet, interfaces
@@ -98,7 +99,7 @@
     Generates list of movements
     """
     movement_list = []
-    trade_condition = context.getTradeConditionValue()
+    trade_condition = context.getTradeConditionValue() # XXX-JPS - which API ?
     business_process = context.getBusinessProcessValue()
 
     if trade_condition is None or business_process is None:
@@ -108,7 +109,7 @@
     for amount in trade_condition.getAggregatedAmountList(context_movement):
       # business path specific
       business_path_list = business_process.getPathValueList(
-          trade_phase=amount.getTradePhaseList())
+          trade_phase=amount.getTradePhaseList()) # Why a list of trade phases ? XXX-JPS
       if len(business_path_list) == 0:
         raise ValueError('Cannot find Business Path')
 
@@ -120,8 +121,8 @@
       kw = self._getPropertyAndCategoryList(context_movement, business_path)
 
       # rule specific
-      kw['price'] = amount.getProperty('price')
-      kw['resource'] = amount.getProperty('resource_list')
+      kw['price'] = amount.getPrice() or amount.getEfficiency()
+      kw['resource'] = amount.getProperty('resource_list') # Inconsistent... list and not list XXX-JPS
       kw['reference'] = amount.getProperty('reference')
       kw['quantity'] = amount.getProperty('quantity')
       kw['base_application'] = amount.getProperty(
@@ -129,11 +130,14 @@
       kw['base_contribution'] = amount.getProperty(
           'base_contribution_list')
 
+      LOG('kw before setting order and delivery to None', 0, repr(kw))
+      kw['order'] = None
+      kw['delivery'] = None # Where does this come from ??? XXX-JPS - Why not None ?
+                            # XXX-JPS Way too many properties are copied
+
       simulation_movement = context.newContent(
         portal_type=RuleMixin.movement_type,
         temp_object=True,
-        order=None,
-        delivery=None,
         **kw)
       movement_list.append(simulation_movement)
 




More information about the Erp5-report mailing list