[Erp5-report] r34139 yo - /erp5/trunk/products/ERP5/Document/SupplyLine.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Mar 26 12:23:08 CET 2010


Author: yo
Date: Fri Mar 26 12:23:07 2010
New Revision: 34139

URL: http://svn.erp5.org?rev=34139&view=rev
Log:
Sort predicates by int_index and id in when getting a list of ids of quantity predicates. Also, make sure that getQuantityPredicateValueList does retrieve only sub-objects.

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

Modified: erp5/trunk/products/ERP5/Document/SupplyLine.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/SupplyLine.py?rev=34139&r1=34138&r2=34139&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/SupplyLine.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/SupplyLine.py [utf8] Fri Mar 26 12:23:07 2010
@@ -177,8 +177,11 @@
         predicate_id_start_with = "%s_%s" % \
             (price_parameter, predicate_id_start_with)
       # XXX Hardcoded portal type name
-      predicate_list = self.contentIds(filter={'portal_type': 'Predicate'})
-      result = [x for x in predicate_list \
+      predicate_list = self.objectValues(portal_type='Predicate',
+              sort_on=('int_index', 'id'))
+      predicate_list.sort(key=lambda p: p.getIntIndex() or p.getId())
+      predicate_id_list = [x.getId() for x in predicate_list]
+      result = [x for x in predicate_id_list \
               if x.startswith(predicate_id_start_with)]
       return result
 
@@ -188,7 +191,7 @@
       """
         Return predicate related to a price parameter.
       """
-      result = [getattr(self, x) for x in \
+      result = [self[x] for x in \
               self.getQuantityPredicateIdList(price_parameter)]
       return result
 




More information about the Erp5-report mailing list