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

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jun 18 06:03:15 CEST 2009


Author: yusuke
Date: Thu Jun 18 06:03:14 2009
New Revision: 27641

URL: http://svn.erp5.org?rev=27641&view=rev
Log:
- changed some method sigunatures.
- changed calling parameters to get a node from a business path.
- fixed get_remaining_trade_phase should be filtered by trade_phase(s)
  of a transformation.

Modified:
    erp5/trunk/products/ERP5/Document/ProductionOrderModelRule.py
    erp5/trunk/products/ERP5/Document/TransformationModelRule.py
    erp5/trunk/products/ERP5/Document/TransformationSourcingModelRule.py

Modified: erp5/trunk/products/ERP5/Document/ProductionOrderModelRule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/ProductionOrderModelRule.py?rev=27641&r1=27640&r2=27641&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/ProductionOrderModelRule.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/ProductionOrderModelRule.py [utf8] Thu Jun 18 06:03:14 2009
@@ -95,12 +95,10 @@
     for prop in default_property_list:
       property_dict[prop] = movement.getProperty(prop)
 
-    explanation = self.getExplanation(applied_rule=applied_rule)
-    path = self.getSpecialise(applied_rule=applied_rule).getRootExplanationValue()
-    property_dict['source_section'] = path.getDestinationSection(explanation)
-    property_dict['source'] = path.getDestination(explanation)
+    path = self.getBusinessProcessValue(applied_rule=applied_rule).getRootExplanationPathValue()
+    property_dict['source_section'] = path.getDestinationSection(context=movement)
+    property_dict['source'] = path.getDestination(context=movement)
 
-    import pdb; pdb.set_trace()
     successor = path.getSuccessorValue()
     if successor is not None:
       property_dict['causality_list'] = successor.getPredecessorRelatedList()

Modified: erp5/trunk/products/ERP5/Document/TransformationModelRule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TransformationModelRule.py?rev=27641&r1=27640&r2=27641&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TransformationModelRule.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TransformationModelRule.py [utf8] Thu Jun 18 06:03:14 2009
@@ -136,8 +136,8 @@
 class TransformationModelRuleMixin(Base):
   security = ClassSecurityInfo()
 
-  security.declareProtected(Permissions.View, 'getTransformation')
-  def getTransformation(self, movement=None, applied_rule=None):
+  security.declareProtected(Permissions.View, 'getTransformationValue')
+  def getTransformationValue(self, movement=None, applied_rule=None):
     """
     Return transformation related to used by the applied rule.
     """
@@ -145,8 +145,8 @@
       movement = applied_rule.getParentValue()
 
     order_movement = movement.getRootSimulationMovement().getOrderValue()
-    explanation = self.getExplanation(movement=movement,
-                                      applied_rule=applied_rule)
+    explanation = self.getExplanationValue(movement=movement,
+                                           applied_rule=applied_rule)
     # find the line of order recursively
     order_line = order_movement
     while order_line.getParentValue() != explanation:
@@ -167,16 +167,16 @@
     if transformation.getResource() == movement.getResource():
       return transformation
 
-  security.declareProtected(Permissions.View, 'getSpecialise')
-  def getSpecialise(self, movement=None, applied_rule=None, portal_type_list=None):
+  security.declareProtected(Permissions.View, 'getBusinessProcessValue')
+  def getBusinessProcessValue(self, movement=None, applied_rule=None, portal_type_list=None):
     """
     Return a business process related to the root causality.
     """
     if portal_type_list is None:
       portal_type_list = self.getPortalBusinessProcessTypeList()
 
-    explanation = self.getExplanation(movement=movement,
-                                      applied_rule=applied_rule)
+    explanation = self.getExplanationValue(movement=movement,
+                                           applied_rule=applied_rule)
     if explanation is not None:
       specialise = explanation.getSpecialiseValue()
       business_process_type_list = self.getPortalBusinessProcessTypeList()
@@ -187,8 +187,11 @@
         specialise = specialise.getSpecialiseValue()
       return specialise
 
-  security.declareProtected(Permissions.View, 'getExplanation')
-  def getExplanation(self, movement=None, applied_rule=None):
+  security.declareProtected(Permissions.View, 'getExplanationValue')
+  def getExplanationValue(self, movement=None, applied_rule=None):
+    """
+    Return the explanation with the movement or the applied_rule.
+    """
     if applied_rule is not None:
       return applied_rule.getRootAppliedRule().getCausalityValue()
     else:
@@ -234,9 +237,9 @@
     """
     parent_movement = applied_rule.getParentValue()
 
-    transformation = self.getTransformation(movement=parent_movement)
-    business_process = self.getSpecialise(movement=parent_movement)
-    explanation = self.getExplanation(movement=parent_movement)
+    transformation = self.getTransformationValue(movement=parent_movement)
+    business_process = self.getBusinessProcessValue(movement=parent_movement)
+    explanation = self.getExplanationValue(movement=parent_movement)
 
     # get all trade_phase of the Business Process
     trade_phase_list = business_process.getTradePhaseList()
@@ -262,6 +265,8 @@
               "the trade phase %r is not part of Business Process %r" % (phase, business_process)
       amount_dict.setdefault(phase, [])
       amount_dict[phase].append(amount)
+
+    transformation_phase_list = amount_dict.keys()
 
     last_phase_path_list = list() # to keep phase_path_list
     last_prop_dict = dict()
@@ -285,18 +290,18 @@
         quantity = factory.product['quantity'] * path.getQuantity()
 
         # nodes at the path
-        source_section = path.getSourceSection(explanation)
-        destination_section = path.getDestinationSection(explanation)
-        source = path.getSource(explanation)
-        destination = path.getDestination(explanation)
+        source_section = path.getSourceSection(context=parent_movement)
+        destination_section = path.getDestinationSection(context=parent_movement)
+        source = path.getSource(context=parent_movement)
+        destination = path.getDestination(context=parent_movement)
 
         # the remaining at the start and the end on the path
         predecessor_remaining_phase_list = path.getPredecessorValue()\
           .getRemainingTradePhaseList(explanation,
-                                      trade_phase_list=trade_phase_list)
+                                      trade_phase_list=transformation_phase_list)
         successor_remaining_phase_list = path.getSuccessorValue()\
           .getRemainingTradePhaseList(explanation,
-                                      trade_phase_list=trade_phase_list)
+                                      trade_phase_list=transformation_phase_list)
  
         consumed_common_dict = dict(source_section=source_section,
                                     destination_section=destination_section,

Modified: erp5/trunk/products/ERP5/Document/TransformationSourcingModelRule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TransformationSourcingModelRule.py?rev=27641&r1=27640&r2=27641&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TransformationSourcingModelRule.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TransformationSourcingModelRule.py [utf8] Thu Jun 18 06:03:14 2009
@@ -82,7 +82,8 @@
     is expanded.
     """
     parent_movement = applied_rule.getParentValue()
-    explanation = self.getExplanation(movement=parent_movement)
+
+    explanation = self.getExplanationValue(applied_rule=applied_rule)
     state = parent_movement.getCausalityValue().getPredecessorValue()
     path_list = state.getSuccessorRelatedValueList()
 
@@ -95,10 +96,10 @@
 
     path = path_list[0]
 
-    source_section = self.getSourceSection(path, applied_rule=applied_rule)
-    destination_section = self.getDestinationSection(path, applied_rule=applied_rule)
-    source = self.getSource(path, applied_rule=applied_rule)
-    destination = self.getDestination(path, applied_rule=applied_rule)
+    source_section = path.getSourceSection(context=parent_movement)
+    destination_section = path.getDestinationSection(context=parent_movement)
+    source = path.getSource(context=parent_movement)
+    destination = path.getDestination(context=parent_movement)
 
     start_date = path.getExpectedStartDate(explanation)
     stop_date = path.getExpectedStopDate(explanation)




More information about the Erp5-report mailing list