[Erp5-report] r8375 - /erp5/trunk/products/ERP5/Document/

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Jul 11 10:16:48 CEST 2006


Author: romain
Date: Tue Jul 11 10:16:47 2006
New Revision: 8375

URL: http://svn.erp5.org?rev=8375&view=rev
Log:
Bug fix: we can now have multiple industrial phase with the same ID and a
different path.

Modified:
    erp5/trunk/products/ERP5/Document/SupplyLink.py
    erp5/trunk/products/ERP5/Document/Transformation.py
    erp5/trunk/products/ERP5/Document/TransformationRule.py
    erp5/trunk/products/ERP5/Document/TransformationSourcingRule.py

Modified: erp5/trunk/products/ERP5/Document/SupplyLink.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/SupplyLink.py?rev=8375&r1=8374&r2=8375&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/SupplyLink.py (original)
+++ erp5/trunk/products/ERP5/Document/SupplyLink.py Tue Jul 11 10:16:47 2006
@@ -142,7 +142,10 @@
           supply_chain = self.getParentValue()
           next_industrial_phase_list = \
               supply_chain.getNextProductionIndustrialPhaseList(self)
-          ind_phase_id_list = [x.getId() for x in next_industrial_phase_list]
+          # XXX GetRelativeUrl copy/paste from transformation
+          # Code duplication
+          ind_phase_url_list = [x.getRelativeUrl() \
+                               for x in next_industrial_phase_list]
 
           # Get the transformation to use
           applied_rule = movement.getParentValue()
@@ -151,7 +154,7 @@
           # Call getAggregatedAmountList
           amount_list = transformation.getAggregatedAmountList(
                        movement.getParentValue().getParentValue(),
-                       ind_phase_id_list=ind_phase_id_list)
+                       ind_phase_url_list=ind_phase_url_list)
           resource_list = [x.getResourceValue() for x in amount_list]
           current_resource = movement.getResourceValue()
           if current_resource not in resource_list:

Modified: erp5/trunk/products/ERP5/Document/Transformation.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Transformation.py?rev=8375&r1=8374&r2=8375&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Transformation.py (original)
+++ erp5/trunk/products/ERP5/Document/Transformation.py Tue Jul 11 10:16:47 2006
@@ -94,6 +94,24 @@
       transformation_line_list = self.contentValues()
       for transformation_line in transformation_line_list:
         transformation_line.updateVariationCategoryList()
+
+    security.declareProtected(Permissions.AccessContentsInformation,
+                              'getVariationRangeBaseCategoryList')
+    def getVariationRangeBaseCategoryList(self):
+      """
+        Returns possible variation base_category ids of the
+        default resource which can be used a variation axis
+        in the transformation.
+      """
+      resource = self.getResourceValue()
+      if resource is not None:
+        result = resource.getVariationBaseCategoryList()
+      else:
+        # XXX result = self.getBaseCategoryIds()
+        # Why calling this method ?
+        # Get a global variable which define a list of variation base category
+        result = self.getPortalVariationBaseCategoryList()
+      return result
 
     security.declareProtected(Permissions.AccessContentsInformation, 
                               'getVariationRangeBaseCategoryItemList')
@@ -206,7 +224,7 @@
     security.declareProtected(Permissions.AccessContentsInformation, 
                               'getAggregatedAmountList')
     def getAggregatedAmountList(self, context=None, REQUEST=None,
-                                ind_phase_id_list=None, 
+                                ind_phase_url_list=None, 
                                 rejected_resource_uid_list=None, 
                                 context_quantity=0,**kw):
       """
@@ -231,11 +249,14 @@
       for transformation in ([self]+template_transformation_list):
         transformation_line_list.extend(transformation.objectValues())
       # Get only lines related to a precise industrial_phase
-      if ind_phase_id_list is not None:
-        transformation_line_list = filter(
-                        lambda x: x.getIndustrialPhaseId() in\
-                                                       ind_phase_id_list,
-                        transformation_line_list)
+      if ind_phase_url_list is not None:
+        new_transf_line_list = []
+        for line in transformation_line_list:
+          ind_ph = line.getIndustrialPhaseValue()
+          if ind_ph is not None:
+            if ind_ph.getRelativeUrl() in ind_phase_url_list:
+              new_transf_line_list.append(line)
+        transformation_line_list = new_transf_line_list
       # Filter lines with resource we do not want to see
       if rejected_resource_uid_list is not None:
         transformation_line_list = filter(

Modified: erp5/trunk/products/ERP5/Document/TransformationRule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TransformationRule.py?rev=8375&r1=8374&r2=8375&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TransformationRule.py (original)
+++ erp5/trunk/products/ERP5/Document/TransformationRule.py Tue Jul 11 10:16:47 2006
@@ -276,13 +276,13 @@
       # Calculate the industrial phase list
       previous_ind_phase_list = supply_chain.\
           getPreviousPackingListIndustrialPhaseList(current_supply_link)
-      ind_phase_id_list = [x.getId() for x in previous_ind_phase_list]
+      ind_phase_id_list = [x.getRelativeUrl() for x in previous_ind_phase_list]
       # Call getAggregatedAmountList
       # XXX expand failed if transformation is not defined.
       # Do we need to catch the exception ?
       amount_list = transformation.getAggregatedAmountList(
                    tmp_context,
-                   ind_phase_id_list=ind_phase_id_list)
+                   ind_phase_url_list=ind_phase_id_list)
       # Add entries in the consumed_movement_dict
       consumed_movement_dict = {}
       for amount in amount_list:

Modified: erp5/trunk/products/ERP5/Document/TransformationSourcingRule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TransformationSourcingRule.py?rev=8375&r1=8374&r2=8375&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TransformationSourcingRule.py (original)
+++ erp5/trunk/products/ERP5/Document/TransformationSourcingRule.py Tue Jul 11 10:16:47 2006
@@ -227,7 +227,8 @@
             }
           })
         # Build the movement
-        self._buildMovementList(applied_rule, movement_dict,activate_kw=activate_kw)
+        self._buildMovementList(applied_rule, movement_dict,
+                                activate_kw=activate_kw)
       # Create one submovement which sources the transformation
       Rule.expand(self, applied_rule, activate_kw=activate_kw, **kw)
 




More information about the Erp5-report mailing list