Commit 2ac19a5f authored by Yoshinori Okuji's avatar Yoshinori Okuji

Sort predicates by int_index and id in when getting a list of ids of quantity...

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.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34139 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9bc3e1df
...@@ -177,8 +177,11 @@ class SupplyLine(Path, XMLMatrix): ...@@ -177,8 +177,11 @@ class SupplyLine(Path, XMLMatrix):
predicate_id_start_with = "%s_%s" % \ predicate_id_start_with = "%s_%s" % \
(price_parameter, predicate_id_start_with) (price_parameter, predicate_id_start_with)
# XXX Hardcoded portal type name # XXX Hardcoded portal type name
predicate_list = self.contentIds(filter={'portal_type': 'Predicate'}) predicate_list = self.objectValues(portal_type='Predicate',
result = [x for x in predicate_list \ 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)] if x.startswith(predicate_id_start_with)]
return result return result
...@@ -188,7 +191,7 @@ class SupplyLine(Path, XMLMatrix): ...@@ -188,7 +191,7 @@ class SupplyLine(Path, XMLMatrix):
""" """
Return predicate related to a price parameter. Return predicate related to a price parameter.
""" """
result = [getattr(self, x) for x in \ result = [self[x] for x in \
self.getQuantityPredicateIdList(price_parameter)] self.getQuantityPredicateIdList(price_parameter)]
return result return result
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment