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

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Jun 7 18:07:27 CEST 2010


Author: yusei
Date: Mon Jun  7 18:07:26 2010
New Revision: 36047

URL: http://svn.erp5.org?rev=36047&view=rev
Log:
Sort composed trade model line list by int_index if all items in the
list have int_index value. This solves undetermined order problem.

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=36047&r1=36046&r2=36047&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TradeCondition.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TradeCondition.py [utf8] Mon Jun  7 18:07:26 2010
@@ -205,6 +205,11 @@
         # at least return original lines retrieved
         final_list = trade_model_line_composed_list
 
+      ### If all items in final_list has int_index value, then sort it by
+      ### int_index to solve undetermined order problem.
+      if len([item for item in final_list if not item.getIntIndex()])==0:
+        final_list.sort(lambda a, b:cmp(a.getIntIndex(), b.getIntIndex()))
+
       return final_list
 
     security.declareProtected(Permissions.AccessContentsInformation,




More information about the Erp5-report mailing list