[Erp5-report] r27291 - /erp5/trunk/products/ERP5/Document/TradeCondition.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Jun 1 12:00:05 CEST 2009


Author: fabien
Date: Mon Jun  1 12:00:04 2009
New Revision: 27291

URL: http://svn.erp5.org?rev=27291&view=rev
Log:
add sorting

Modified:
    erp5/trunk/products/ERP5/Document/TradeCondition.py

Modified: erp5/trunk/products/ERP5/Document/TradeCondition.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TradeCondition.py?rev=27291&r1=27290&r2=27291&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TradeCondition.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TradeCondition.py [utf8] Mon Jun  1 12:00:04 2009
@@ -120,7 +120,6 @@
       Reference of Trade Model Line is used to hide other Trade Model Line
       In chain first found Trade Model Line has precedence
       Context's, if not None, Trade Model Lines have precedence
-        XXX - the sorting is missing
       """
       visited_trade_condition_list = []
       def findSpecialiseValueList(context):
@@ -133,6 +132,9 @@
           visited_trade_condition_list.append(specialise)
           specialise_value_list.extend(findSpecialiseValueList(specialise))
         return specialise_value_list
+
+      def sortByIntIndex(a, b):
+        return cmp(a.getIntIndex(), b.getIntIndex())
 
       reference_list = []
       trade_model_line_composed_list = []
@@ -153,6 +155,8 @@
           if reference not in reference_list:
             trade_model_line_composed_list.append(trade_model_line)
             reference_list.append(reference)
+
+      trade_model_line_composed_list.sort(sortByIntIndex)
       return trade_model_line_composed_list
 
     def getAggregatedAmountList(self, context, **kw):




More information about the Erp5-report mailing list