[Erp5-report] r26461 - in /erp5/trunk/products/ERP5: Document/ PropertySheet/

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Apr 16 17:50:54 CEST 2009


Author: seb
Date: Thu Apr 16 17:50:51 2009
New Revision: 26461

URL: http://svn.erp5.org?rev=26461&view=rev
Log:
- do no set hardcoded values for the list of properties to
  copy on simulation movements, allow to set them inside portal_rules
- keep compatibility with existing not defined rules
- remove the default_property_list parameter to _getExpandablePropertyDict,
  it looks like to not be used, and it is better to define it
  on the rule itself

Modified:
    erp5/trunk/products/ERP5/Document/OrderRule.py
    erp5/trunk/products/ERP5/Document/ProductionOrderRule.py
    erp5/trunk/products/ERP5/PropertySheet/AppliedRule.py

Modified: erp5/trunk/products/ERP5/Document/OrderRule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/OrderRule.py?rev=26461&r1=26460&r2=26461&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/OrderRule.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/OrderRule.py [utf8] Thu Apr 16 17:50:51 2009
@@ -57,6 +57,7 @@
                     , PropertySheet.CategoryCore
                     , PropertySheet.DublinCore
                     , PropertySheet.Task
+                    , PropertySheet.AppliedRule
                     )
 
   # Simulation workflow
@@ -160,18 +161,20 @@
 
   security.declareProtected(Permissions.AccessContentsInformation,
                             '_getExpandablePropertyDict')
-  def _getExpandablePropertyDict(self, applied_rule, movement,
-                                 default_property_list=None, **kw):
+  def _getExpandablePropertyDict(self, applied_rule, movement, **kw):
     """
     Return a Dictionary with the Properties used to edit 
     the simulation movement
     """
     property_dict = {}
 
-    if default_property_list is None:
-      # XXX Hardcoded value
-#       LOG("Order Rule , _getPropertiesTo", WARNING,
-#                                 "Hardcoded properties set")
+    default_property_list = self.getExpandablePropertyList()
+    # 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("Order Rule , _getExpandablePropertyDict", WARNING,
+                 "Hardcoded properties set, please define your rule correctly")
       default_property_list = (
         'source',
         'source_section',
@@ -195,8 +198,8 @@
         'quantity_unit',
       )
   
-      for prop in default_property_list:
-         property_dict[prop] = movement.getProperty(prop)
+    for prop in default_property_list:
+       property_dict[prop] = movement.getProperty(prop)
        
     return property_dict
 

Modified: erp5/trunk/products/ERP5/Document/ProductionOrderRule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/ProductionOrderRule.py?rev=26461&r1=26460&r2=26461&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/ProductionOrderRule.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/ProductionOrderRule.py [utf8] Thu Apr 16 17:50:51 2009
@@ -58,23 +58,26 @@
                       , PropertySheet.CategoryCore
                       , PropertySheet.DublinCore
                       , PropertySheet.Task
+                      , PropertySheet.AppliedRule
                       )
 
     # Simulation workflow
     security.declareProtected(Permissions.AccessContentsInformation,
                               '_getExpandablePropertyDict')
-    def _getExpandablePropertyDict(self, applied_rule, movement, 
-                                   default_property_list=None, **kw):
+    def _getExpandablePropertyDict(self, applied_rule, movement, **kw):
       """
       Return a Dictionary with the Properties used to edit 
       the simulation movement.
       """
       property_dict = {}
 
-      if default_property_list is None:
-        # XXX Hardcoded value
-#         LOG("Order Rule , _getExpandablePropertyDict", WARNING,
-#             "Hardcoded properties set")
+      default_property_list = self.getExpandablePropertyList()
+      # 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("Order Rule , _getExpandablePropertyDict", WARNING,
+                   "Hardcoded properties set, please define your rule correctly")
         default_property_list = (
           'destination', 
           'destination_section',

Modified: erp5/trunk/products/ERP5/PropertySheet/AppliedRule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/PropertySheet/AppliedRule.py?rev=26461&r1=26460&r2=26461&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/PropertySheet/AppliedRule.py [utf8] (original)
+++ erp5/trunk/products/ERP5/PropertySheet/AppliedRule.py [utf8] Thu Apr 16 17:50:51 2009
@@ -50,6 +50,12 @@
 
             'type'        : 'string',
             'mode'        : 'w' },
+        {  'id'          : 'expandable_property',
+           'description' : 'List of properties used in expand',
+           'type'        : 'lines',
+           'default'     : [],
+           'multivalued' : 1,
+           'mode'        : 'w' },
   )
 
   _categories = ('specialise', 'causality', 'order', )




More information about the Erp5-report mailing list