[Erp5-report] r32452 kazuhiko - /erp5/trunk/products/ERP5/Document/

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Feb 12 01:32:40 CET 2010


Author: kazuhiko
Date: Fri Feb 12 01:32:38 2010
New Revision: 32452

URL: http://svn.erp5.org?rev=32452&view=rev
Log:
override getExpandablePropertyList() instead of _getExpandablePropertyDict() to provide the default value.

Modified:
    erp5/trunk/products/ERP5/Document/DeliveryRule.py
    erp5/trunk/products/ERP5/Document/OrderRule.py

Modified: erp5/trunk/products/ERP5/Document/DeliveryRule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/DeliveryRule.py?rev=32452&r1=32451&r2=32452&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/DeliveryRule.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/DeliveryRule.py [utf8] Fri Feb 12 01:32:38 2010
@@ -200,63 +200,43 @@
       return 0
     return 1
 
-  def _getExpandablePropertyDict(self, applied_rule, movement,
-      business_path=None, **kw):
-    """
-    Return a Dictionary with the Properties used to edit
-    the simulation movement
-    """
-    if self._isBPM():
-      return Rule._getExpandablePropertyDict(self, applied_rule,
-          movement, business_path, **kw)
-    property_dict = {}
-
-    default_property_list = self.getExpandablePropertyList()
+  security.declareProtected(Permissions.AccessContentsInformation,
+                            'getExpandablePropertyList')
+  def getExpandablePropertyList(self, default=None):
+    """
+    Return a list of properties used in expand.
+    """
+    property_list = self._baseGetExpandablePropertyList()
     # For backward compatibility, we keep for some time the list
     # of hardcoded properties. Theses properties should now be
     # defined on the rule itself
-    if len(default_property_list) == 0:
-      LOG("Delivery Rule , _getExpandablePropertyDict", WARNING,
-          "Hardcoded properties set, please define your rule correctly")
-      default_property_list = (
-        'source',
-        'source_section',
-        'source_function',
-        'source_account',
-        'source_administration',
-        'source_decision',
-        'source_project',
-        'source_payment',
+    if len(property_list) == 0:
+      LOG("Order Rule , _getExpandablePropertyDict", WARNING,
+                 "Hardcoded properties set, please define your rule correctly")
+      property_list = (
+        'aggregate_list',
+        'base_application_list',
+        'base_contribution_list',
+        'description',
         'destination',
+        'destination_account',
+        'destination_function',
         'destination_section',
-        'destination_function',
-        'destination_account',
-        'destination_administration',
-        'destination_decision',
-        'destination_project',
-        'destination_payment',
-        'start_date',
-        'stop_date',
-        'description',
-        'resource',
-        'variation_category_list',
-        'variation_property_dict',
-        'base_contribution_list',
-        'base_application_list',
-        'aggregate_list',
         'price',
         'price_currency',
         'quantity',
         'quantity_unit',
-        'incoterm',
+        'resource',
+        'source',
+        'source_account',
+        'source_function',
+        'source_section',
+        'start_date',
+        'stop_date',
+        'variation_category_list',
+        'variation_property_dict',
       )
-
-    for prop in default_property_list:
-       property_dict[prop] = movement.getProperty(prop)
-
-    if movement.hasTitle():
-      property_dict['title'] = movement.getTitle()
-    return property_dict
+    return property_list
 
   def _getInputMovementList(self, applied_rule):
     """Return list of movements from delivery"""

Modified: erp5/trunk/products/ERP5/Document/OrderRule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/OrderRule.py?rev=32452&r1=32451&r2=32452&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/OrderRule.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/OrderRule.py [utf8] Fri Feb 12 01:32:38 2010
@@ -149,52 +149,41 @@
     return Rule.isDivergent(self, movement)
 
   security.declareProtected(Permissions.AccessContentsInformation,
-                            '_getExpandablePropertyDict')
-  def _getExpandablePropertyDict(self, applied_rule, movement,
-      business_path=None, **kw):
-    """
-    Return a Dictionary with the Properties used to edit 
-    the simulation movement
-    """
-    if self._isBPM():
-      return DeliveryRule._getExpandablePropertyDict(self, applied_rule,
-          movement, business_path, **kw)
-    property_dict = {}
-
-    default_property_list = self.getExpandablePropertyList()
+                            'getExpandablePropertyList')
+  def getExpandablePropertyList(self, default=None):
+    """
+    Return a list of properties used in expand.
+    """
+    property_list = self._baseGetExpandablePropertyList()
     # For backward compatibility, we keep for some time the list
     # of hardcoded properties. Theses properties should now be
     # defined on the rule itself
-    if len(default_property_list) == 0:
+    if len(property_list) == 0:
       LOG("Order Rule , _getExpandablePropertyDict", WARNING,
                  "Hardcoded properties set, please define your rule correctly")
-      default_property_list = (
-        'source',
-        'source_section',
-        'source_function',
-        'source_account',
+      property_list = (
+        'aggregate_list',
+        'base_contribution_list',
+        'description',
         'destination',
+        'destination_account',
+        'destination_function',
         'destination_section',
-        'destination_function',
-        'destination_account',
-        'start_date',
-        'stop_date',
-        'description',
-        'resource',
-        'variation_category_list',
-        'variation_property_dict',
-        'base_contribution_list',
-        'aggregate_list',
         'price',
         'price_currency',
         'quantity',
         'quantity_unit',
+        'resource',
+        'source',
+        'source_account',
+        'source_function',
+        'source_section',
+        'start_date',
+        'stop_date',
+        'variation_category_list',
+        'variation_property_dict',
       )
-  
-    for prop in default_property_list:
-       property_dict[prop] = movement.getProperty(prop)
-       
-    return property_dict
+    return property_list
 
   def _getInputMovementList(self, applied_rule):
     """Input movement list comes from order"""




More information about the Erp5-report mailing list